Getting PID for process

John Abel jabel at plus.net
Fri Apr 29 06:45:37 EDT 2005


try:

import os

myPID = os.getpid()

So you can kill it at a later date, it would be worth writing that out 
to a file somewhere - C:\temp?  I'm sure you can get a kill command for 
Win32.

HTH

J

Harlin Seritt wrote:

>Let's say I have a simple script on Windows NT. I would like for that
>script to find its own PID once it's started and store that as a value
>within the script. Also, down the road I'd like to kill that process by
>its PID. How is this done?
>
>Thanks,
>
>Harlin Seritt
>
>  
>




More information about the Python-list mailing list