Moiz
Moiz

Reputation: 305

Listing the processes running on one's computer in Python

Is there a cross-platform way to list the processes running on one's computer through a python script? For Unix based system "ps -ef" works, but I am new to Python and don't know a way to write something that would work across any platform.

Thanks!

Upvotes: 3

Views: 902

Answers (2)

anatoly techtonik
anatoly techtonik

Reputation: 20531

While PSI page lists some alternatives, what you need is psutil. It is the only one that supports Windows, or as it states on a home page:

Linux, Windows, OSX and FreeBSD both 32-bit and 64-bit with Python versions from 2.4 to 3.2.

Upvotes: 1

Martin v. Löwis
Martin v. Löwis

Reputation: 127457

Python itself doesn't offer any such functionality. On PyPI, there is the enumprocess package, which supposedly helps; there is also the PSI package. I haven't personally used any of them.

Upvotes: 2

Related Questions