<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>
<p dir="ltr">How would I get a list of running processes with the subprocess module? The documentation wasn't clear to me.<br>
</p>
<div class="x_quote">On Jan 21, 2015 7:21 PM, Dan Stromberg <drsalists@gmail.com> wrote:<br type="attribution">
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On Wed, Jan 21, 2015 at 3:06 PM, Jason Bailey <jbailey@emerytelcom.com> wrote:<br>
> So I've got this python 3 script that needs to know if there is a running<br>
> DHCP daemon (ISC DHCP server) on the local system. Is there a clean way to<br>
> do this that (1) doesn't require me to do syscalls to local utilities (like<br>
> ps, top, etc), and (2) doesn't require any custom modules (stock only)?<br>
<br>
The subprocess module is quite clean on *ix. Don't let the subprocess<br>
mess on Windows steer you away from it on *ix. And don't let the<br>
"subprocesses are bad" from the perl community misguide you either -<br>
shell is fast today because it's highly parallel, because it's<br>
unafraid of subprocesses.<br>
<br>
You could open the files under /proc and look around, if you're on<br>
Linux. But parsing "ps -eo whatever" would probably be cleaner.<br>
<br>
A "syscall" is an interaction with a kernel. I think you meant an<br>
os.system() call.<br>
<br>
</div>
</span></font>
</body>
</html>