Reading stdout and stderr of an external program
Ben Cartwright
benc.nospam at gmail.com
Mon Jul 2 12:00:19 EDT 2007
More information about the Python-list mailing list
Mon Jul 2 12:00:19 EDT 2007
- Previous message (by thread): Reading stdout and stderr of an external program
- Next message (by thread): Reading stdout and stderr of an external program
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> 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?
from subprocess import Popen
stdout, stderr = Popen('my_prog').communicate()
--Ben
- Previous message (by thread): Reading stdout and stderr of an external program
- Next message (by thread): Reading stdout and stderr of an external program
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list