[Tutor] Getting process output in real time

Neil Hodge hodge3@llnl.gov
Thu May 1 11:41:04 2003


All:

I am building a GUI to wrap around a CLI program.  One of the functions 
of the CLI outputs a progress bar, something like the following:

[0....25....50....75....100]

I am using one of the os.popen variants for all of my other system 
calls, and getting the stdout works perfectly.  Since all of the other 
functions are very quick or give no status updates, this would be a moot 
question.  But for this function, I would like to get the stdout back in 
real time so that I can display it in the GUI.  I note that in

http://www.python.org/doc/current/lib/popen2-flow-control.html

while not necessarily directly my situation, there is the idea that

"In particular, note that sys.stderr must be closed after writing all 
data, or readlines() won't return."

I'm not quite sure how this would be useful, but I may be able to do 
something with it.

Any other ideas?  Thanks.

Neil