Controlling processes (popen2)

Daniel Klein DanielK at
Sun Dec 31 03:02:08 CET 2000

"D'Arcy J.M. Cain" <darcy at> wrote in message
news:92l7e2$1pbu$1 at
> Daniel Klein <DanielK at> wrote:
> > The problem is that in Python I have to terminate all output to the
> > process with a \r (rather than \n). In Java, I can use either \n or \r.
> I don't use Windows or BASIC so this is just a hunch.  What happens if
> you popen with "wt" as the second argument?  That extra 't' is benign
> under Unix.

Thanks for the suggestion D'Arcy, but the 'popen2' module only accepts a
mode of 'b' (binary) or 't' (text, this is default). 'wt' is not valid. I
did try explicitly using mode='t' but there was no change in the behavior.

For all practical purposes you can consider the 'child' process a C program
that accepts two inputs and prints the output of both.


More information about the Python-list mailing list