Is a win32 process running using the pid.

Tim Golden tim.golden at
Tue Feb 3 14:54:43 CET 2004

>-----Original Message-----
>From: at 
>[ at]
>Sent: 03 February 2004 11:53
>To: python-list at
>Subject: Is a win32 process running using the pid.
>Hi, I created a function, which seems to work, quite well, it tells me
>if a process is running in widows using the pid number (I'm aware that
>the pid number in widows is not called a pid and this is really a unix
>thing but what the hell). The function keeps crashing (I've included
>the crash but I don't think it will do any good.), only sometimes,
>most of the time it works fine and I don't know why, Could any body
>suggest anything, maybe someone has a stable function that can do the
>below :

[... snip crash and function details ...]

Oh my goodness! Perhaps I've misunderstood, but if
all you want to do is see if a process with a particular
id is running, it's got to be easier than that. I would
have thought that something would be possible using
win32process, although nothing jumps out at me.

Certainly you can do it using WMI. A naive function
would look something like this:

import wmi
c = wmi.WMI ()

def is_this_process_running (id):
  return len (c.Win32_Process (ProcessId=id))

Something slightly more sophisticated could use
a WMI event. Something like this, perhaps:

Sorry if I've misunderstood your intention. Hope it helps.

This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

More information about the Python-list mailing list