Processes in Linux from Python

Johny python at hope.cz
Mon Sep 1 02:25:56 EDT 2008


To get a number of  the http processes running on my Linux( Debia box)
I use
ps -ef | grep "[h]ttpd" | wc -l

But If I want to use to get a number of the http processes from my
Python program I must use  a popen command e.g.
popen2.popen3('ps -ef | grep "[h]ttpd" | wc -l')
that is I must call an external  command from Python.

But it creates a zombie.
So my question is:
Is it possible to get a number of the http processes running on Linux
directly from Python ?

Thanks for help.
L.



More information about the Python-list mailing list