-
-
Save eight04/fe6dd335e264a6a74e7d to your computer and use it in GitHub Desktop.
List all process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! python3 | |
import psutil, sys | |
print(sys.version_info, psutil.__version__) | |
for p in psutil.process_iter(): | |
print(p.pid) | |
try: | |
print(" ", p.name()) | |
except Exception as err: | |
print(" failed to get name", type(err)) | |
try: | |
print(" ", p.memory_percent()) | |
except Exception as err: | |
print(" failed to get memory", type(err)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment