how to start a process and get it's pid?

Daniel Crespo dcrespo at gmail.com
Fri Nov 11 10:16:21 EST 2005


> >>> import subprocess
> >>> p = subprocess.Popen("c:/windows/notepad.exe")
> >>> p.pid

> 1948

Yes, it works. But in my case, I need to run the program totally
separated from my main program. So, when I start a new program through
subprocess, it doesn't unlink. I mean, if I close my main app, so does
the launched program. With startfile() it does the job, but I then I
have to find what pid is through win32all module, etc.

it would be very good if I can use spawnl

Daniel




More information about the Python-list mailing list