Reading the error stream from os.popen()

Carsten Gaebler cg at schlund.de
Thu Oct 19 09:41:12 EDT 2000


Tov Are Jacobsen wrote:
> The msgfmt command below outputs info to the stderr stream,
> but the read() method retrieves data from stdin.
> 
> s = os.popen('/usr/bin/msgfmt  --statistics '+x[0]+'.po').read()


Redirect stderr to stdout:

s = os.popen('/usr/bin/msgfmt  --statistics '+x[0]+'.po' 2>&1).read()


cg.



More information about the Python-list mailing list