os.popen in unbuffered mode?

Peter Hansen peter at engcorp.com
Thu May 22 14:55:52 EDT 2003


Jonathan Mackenzie wrote:
> 
> Using os.popen("command", 'r', 0) on Windows 2000 (python 2.2.1) and I
> get:
> 
>     pa = os.popen(progStr, 'r', 0)
> ValueError: popen() arg 3 must be -1
> 
> Can anyone please tell me how to put popen into unbuffered mode?  I'm
> looking to get real-time returns from the subprocess, which is writing
> to stdout.

Isn't it the subprocess which has to be using an unbuffered stdout?
You can't make popen compensate for a program which doesn't flush its
own output...

-Peter




More information about the Python-list mailing list