How to find out the pid of a running program?

Peter Torstenson p.t at iname.com
Sun Aug 1 06:57:44 EDT 1999


> Peter Torstenson wrote:
> >
> > I'd like tknow if there is a way of getting the pid of a program
running,
> > using python commands?
>
> Use the getpid() function from the posix module which is imported
> automatically when you import the os module.  Don't import the posix
> module directly.  Do it via the os module since this will afford you
> code better portablility.  Refer to the Python Library Reference for
> more info.

I think I didn't express myself clearly!
I want to find out the pid of another program than the one I give
the command from!
Ex. the pid of the running pppd.
The getpid() function returns the pid of the python program it self as far
as I understand.








More information about the Python-list mailing list