Get the status of a process

Michael Hudson mwh at python.net
Fri Nov 28 08:08:26 EST 2003


Gilles Lenfant <nospam.glenfant at bigfoot.com> writes:

> Hi,
> 
> I'm pretty brain dead reading the python docs about the processes.
> 
> I'm looking for some pythonig way to do a...
> 
> $ ps x | grep <some_pid>
> 
> ... in order to know if <some_pid> is running or not.
> 
> Thanks in advance for any hint.

os.kill(some_pid, 0)?

You might get EPERM if the process is running, but as a different
user.

Cheers,
mwh

-- 
  Gullible editorial staff continues to post links to any and all
  articles that vaguely criticize Linux in any way.
         -- Reason #4 for quitting slashdot today, from
            http://www.cs.washington.edu/homes/klee/misc/slashdot.html




More information about the Python-list mailing list