Reading stdout and stderr of an external program

Thomas Jollans thomas at
Mon Jul 2 18:01:00 CEST 2007

On Monday 02 July 2007, Murali wrote:
> Hi Python programmers,
> I need to be able to read the stdout and stderr streams of an external
> program that I launch from my python script. os.system( 'my_prog' +
> '>& err.log' ) and was planning on monitoring err.log and to display
> its contents. Is this the best way to do this?

No. The best way to do this is with Popen, as it is portable and avoids the 
extranous file.

      Regards,                       Thomas Jollans
GPG key: 0xF421434B may be found on various keyservers, eg
Hacker key <>:

More information about the Python-list mailing list