Non-blocking read with popen subprocess
Piet van Oostrum
piet at cs.uu.nl
Fri Jul 31 03:47:34 EDT 2009
>>>>> Jonathan Gardner <jgardner at jonathangardner.net> (JG) wrote:
>JG> On Jul 30, 5:24 pm, Dhanesh <dhanesh... at gmail.com> wrote:
>>>
>>> how can I we have a non blocking read ?
>JG> See http://docs.python.org/library/popen2.html#flow-control-issues
>JG> Note well: In the non-blocking world, you have to use select() or poll
>JG> () to get your job done.
AFAIK, on Windows these work only on sockets, not on files. I think
pipes are in the files camp.
Alternatively you can read one of the two in a different thread.
>JG> You may want to look at "communicate" (http://docs.python.org/library/
>JG> subprocess.html#popen-objects) which may be what you need.
--
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org
More information about the Python-list
mailing list