Thanks Bob, for the prompt response. I guessed as much. In any case, select over a pipe isn't portable to Windows, so I converted it to a threaded + blocking I/O. Simpler code and works well enough for my case (I won't end up spawning too many threads)
--Sriram On Aug 4, 2005, at 6:41 AM, Bob Ippolito wrote: > > On Aug 3, 2005, at 1:07 PM, Sriram Srinivasan wrote: > > >> I wonder if anyone has seen this behavior or can explain it to me. >> >> I Popen a process and monitor its stdout using select, as follows. >> >> process = Popen(args,stdin=PIPE, stdout=PIPE, stderr=PIPE) >> while True: >> if not (process.returncode == None): >> print process.returncode >> break >> ready,_, _ = select.select([process.stdout, process.stderr], >> [], [], 5) >> if ready: >> for fd in ready: >> print fd.readline() >> >> Now this works fine, in that it dumps out everything that the program >> can print, but when the exec'd program finishes executing, the select >> () call just hangs. The timeout on the select has no effect. >> > > I'm relatively sure that subprocess module is not suitable for non- > blocking IO like that... Check the docs or shoot a message over to > python-list, I'm sure someone there knows. > > -bob > > > > _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig