How to get a PID of a child process from a process openden with Popen()

P.S. nospam at nospan.no
Fri Apr 8 12:40:10 CEST 2011


Hello,

I am starting a GUI-application as another user with kdesu in my python
script:

	import shlex, subprocess

	p = subprocess.Popen(shlex.split("kdesu -u test program"))

How can I aquire the PID of the program which kdesu starts?
p.pid just returns the PID of kdesu, but I need the PID of the
child process from kdesu.

My System: openSUSE 11.4 64-Bit, Python 2.7.

Regards
Pedro Santos



More information about the Python-list mailing list