How can I get a complete list of running processes on a Mac from a python application

I want a list of running processes on a Mac, similar to what you get from "ps -ea"

I tried os.popen ('ps -ea') , but this only displays a small subset of processes supposedly owned by the shell.

Other options I've tried

'sh -c /bin/ps -ea' 'bash -c /bin/ps -ea' 'csh -c /bin/ps -ea' Running as root via sudo data = subprocess.Popen(['ps','ea'], stdout=subprocess.PIPE).stdout.readlines() 

What other methods exist that can give me a complete list of process information?

This is for a python wx application to monitor certain processes and detect when they die.

+2
python process macos
Nov 04 '09 at 13:52
source share
1 answer

os.popen('ps aux') looks like an enumeration of all processes for me.

+7
Nov 04 '09 at 14:11
source share



All Articles