Rob Wolfe wrote:
Ian Simcock <ian.simc...@internode.on.net> writes:

When file object is used in a for loop it works like an iterator
and then it uses a hidden read-ahead buffer.
It might cause this kind of blocking.
You can read more details here (description of method ``next``):
http://docs.python.org/lib/bltin-file-objects.html

So basically non-blocking loop might look like this:

while True:
     line = p.stdout.readline()
     if not line: break
     print line

HTH,
Rob


Thanks, but some further research seems to indicate that the problem is that the standard C libraries are probably buffering the output when the it's being redirected, so the problem is coming from the command line tool rather than the python code.

Ian Simcock.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to