how do I pipe two processes?

Peter Otten __peter__ at web.de
Thu Feb 1 07:54:40 EST 2007


Bilgehan.Balban at gmail.com wrote:

> Hi, I want to pipe output of process A to B, and read output of B from
> python. On Unix if I do the following:
> 
> child_out, child_in = popen2("program_a | program_b")
> 
> line = child_out.readline()
> 
> I get "IOError: bad file descriptor" from Python, and broken pipe
> error from program_b. How do I do this right?

In through the out door? From the docs:

... Returns the file objects (child_stdin, child_stdout) ...

Peter



More information about the Python-list mailing list