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

Yves Glodt y.glodt at sitasoftware.lu
Fri Nov 11 10:58:43 EST 2005


Gerhard Häring wrote:
> Yves Glodt wrote:
>> Hello,
>>
>> another question rose for me today...
>>
>> Is there a way to start an external process, in it's own context (not as 
>> the exec-() functions do), and get it's pid...? [...]
> 
> Check out the subprocess module if you're using Python 2.4.
> 
> Otherwise, you can always use os.spawn*, for example:
> 
>  >>> os.spawnl(os.P_NOWAIT, "c:/windows/notepad.exe")
> 1944

Thanks, in Linux it seems to work.

> HTH,
> 
> -- Gerhard
> 



More information about the Python-list mailing list