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

Fredrik Lundh fredrik at pythonware.com
Wed Jun 7 18:27:02 EDT 2006


mikem76 at gmail.com wrote:

> Is there a way to get the process id when starting a process using
> os.popen2 or os.popen3 on linux?

on Unix, os.popen2/popen3 uses functions and classes from the popen2 
module.  they return file objects attached to the process, but there's
no (non-hacky) way to get at the process itself.

if you need more control over the subprocess, you can use the classes in 
the popen2 module, or, better, the subprocess module.

</F>




More information about the Python-list mailing list