How to catch a line with Popen

Tim Roberts timr at probo.com
Sat May 28 19:32:42 EDT 2011


TheSaint <nobody at nowhere.net.no> wrote:
>
>I'm looking into subprocess.Popen docs.
>I've launch the program with its arguments and that's smooth. I'm expecting 
>to read the output by *comunicate()* at every line that prgram may blow 
>during the process, but the output is given only when the child process is 
>ended.
>I'd like to process the lines to display an information in percentage during 
>the running time of the child.

Are you specifying a buffer size in the Popen command?  If not, then the
Python side of things is unbuffered.  It's possible that the application
you are launching is buffering its output, so that it doesn't SEND until
the application ends.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list