Getting stdout and stderr from popen

Stefan Heimann stefan.heimann at web.de
Wed Mar 6 04:39:24 EST 2002


Hi!

I want to launch an external process and have stdout and stderr
redirected to one output stream, something like

f = os.popen('cvs status 2>&1')

does the right thing, but does not work on all platforms.

If I write

pin, pout, perr = os.popen3('cvs status')

I get the output of stderr and stdout but not in the right order.

I tried also

sys.stderr = sys.stdout
f = os.popen('cvs status')
f.read()

but still I get only the output from stdout (what cvs outputs on
stderr is written directly to the console).

Any help would b great!

Thanks and bye
  Stefan



More information about the Python-list mailing list