Reading output from a child process non-blockingly

ilochab at ilochab at
Wed Jun 29 12:31:48 CEST 2005

Yuan HOng ha scritto:
> In my program I have to call an external program and parse its output.
> For that I use the os.popen2 function, and then read the output
> stream.
> But the complexity is that the external program gives back its output
> in a piecemeal manner, with long delays between the outputs. In the
> main program I want to therefore read the output in a non-blocking
> manner, to read as many bytes as the child process is spitting out.
> The question is, how can I achieve that?

What about using a thread to control the child process?


More information about the Python-list mailing list