How to catch a line with Popen

TheSaint nobody at nowhere.net.no
Sun May 29 06:02:43 EDT 2011


Tim Roberts wrote:

> Are you specifying a buffer size in the Popen command?  If not, then the
> Python side of things is unbuffered

The buffer is as per default. The program reports one line around 1/2 second 
time.
I think I'll look into the option as Nobody states:

        p = subprocess.Popen(...)
        for line in p.stdout:
            ...
        p.wait()

It is strange that would take a for cycle, rather than catching the line on-
the-fly. I can judge it now, I'm going to try it out.

-- 
goto /dev/null



More information about the Python-list mailing list