How would I get a list of running processes with the subprocess module? The documentation wasn't clear to me.
On Jan 21, 2015 7:21 PM, Dan Stromberg <drsali...@gmail.com> wrote: On Wed, Jan 21, 2015 at 3:06 PM, Jason Bailey <jbai...@emerytelcom.com> wrote: > So I've got this python 3 script that needs to know if there is a running > DHCP daemon (ISC DHCP server) on the local system. Is there a clean way to > do this that (1) doesn't require me to do syscalls to local utilities (like > ps, top, etc), and (2) doesn't require any custom modules (stock only)? The subprocess module is quite clean on *ix. Don't let the subprocess mess on Windows steer you away from it on *ix. And don't let the "subprocesses are bad" from the perl community misguide you either - shell is fast today because it's highly parallel, because it's unafraid of subprocesses. You could open the files under /proc and look around, if you're on Linux. But parsing "ps -eo whatever" would probably be cleaner. A "syscall" is an interaction with a kernel. I think you meant an os.system() call.
-- https://mail.python.org/mailman/listinfo/python-list