Reading the error stream from os.popen()

Mikael Olofsson mikael at isy.liu.se
Thu Oct 19 10:05:50 EDT 2000


On 19-Oct-00 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()
 >  
 >  Any ideas? (I would like to make my script to work with an
 >  unmodified version of msgfmt) :-)

You could take a look at the module popen2, and especially
the functions popen2.popen2 and popen2.popen3.

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson <mikael at isy.liu.se>
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael               
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    19-Oct-00
Time:    16:03:47

         /"\
         \ /     ASCII Ribbon Campaign
          X      Against HTML Mail
         / \

This message was sent by XF-Mail.
-----------------------------------------------------------------------



More information about the Python-list mailing list