How do I automatically redirect stdout and stderr when using os.popen2?

mikem76 at gmail.com mikem76 at gmail.com
Wed Jun 7 12:07:10 EDT 2006


How do I automatically redirect stdout and stderr when using os.popen2
to start a long running process.  If the process prints a lot of stuff
to stdout it will eventually stop because it runs out of buffer space.
Once I start reading the stdout file returned by os.popen2 then the
process resumes.  I know that I could just specify > /dev/null when
starting the process but I'd like to know if there is a way to start a
process using os.popen2 or some other way so that all standard out and
standard error goes to /dev/null or some other file.

Thanks,
Mike




More information about the Python-list mailing list