Instead of the cumbersome subprocess
, you can use the fabolous, cross-platform psutil library.
Using the general purpose psutil.process_iter()
will allow you to do pretty much anything you'd like with the Process
objects it returns (get name, pid, filter the ones you're interested in, etc.)
E.g.
for proc in psutil.process_iter():
print proc.pid, proc.name