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

2006-06-07 Thread mikem76
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.

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

2006-06-07 Thread mikem76
Here is what I ended up doing: si = file('/dev/null', 'r') so = file('/dev/null', 'a+') i,o = os.popen2('some_command_that_prints_a_lot_to_stdout') os.dup2(so.fileno(), o.fileno()) os.dup2(si.fileno(), i.fileno()) Thanks for your help, Mike Grant Edwards wrote: On 2006-06-07, [EMAIL PROTECTED]

How do I get the process id when starting a process using os.popen2 or os.popen3 on linux?

2006-06-07 Thread mikem76
Is there a way to get the process id when starting a process using os.popen2 or os.popen3 on linux? Mike -- http://mail.python.org/mailman/listinfo/python-list