Python: read streaming input from subprocess.communicate()

Posted by Heinrich Schmetterling on Stack Overflow See other posts from Stack Overflow or by Heinrich Schmetterling
Published on 2010-04-26T18:23:18Z Indexed on 2010/04/26 18:23 UTC
Read the original article Hit count: 145

Filed under:

I'm using Python's subprocess.communicate() to read stdout from a process that runs for about a minute. How can I print out each line of that process's stdout in a streaming fashion, so that I can see the output as it's generated, but still block on the process terminating before continuing? subprocess.communicate() appears to give all the output at once.

© Stack Overflow or respective owner

Related posts about python