Get python cpu usage
6,979
Solution 1
Us psutil module, it provides for memory, cpu, netowrk, etc usages. Visit their project webpage http://code.google.com/p/psutil/ .
Solution 2
Lucky ol' you gets to dig around in WMI. Check out the Python module 'wmi' which is about as good as I've seen.
Solution 3
You are missing the python win32 extensions which you can find here.
Author by
Wegged
Sysadmin of a small network ~30pc's 2 servers. I like IT, and i'm doing this as an extra responsability at my job. Keeping IT in the company works great for us :)
Updated on September 17, 2022Comments
-
Wegged over 1 year
Anyone using a Python script to monitor CPU usage on a Windows machine ? i've google for some time but have not been able to find any usable script. could you guys show me some example of what you're using ?
Here is the errors i got.
Traceback (most recent call last): File "test.py", line 1, in import wmi File "c:\Python26\lib\site-packages\wmi.py", line 141, in from win32com.client import GetObject, Dispatch ImportError: No module named win32com.client
-
Alex J almost 15 yearsDid you install pywin32?
-
Wegged almost 15 yearshowdy, i installed win32 on another machine and it works like a charm. for my developing app i decided to use perl instead, since the ActivePerl package installer is very easy to use, and permits me to search and add what pachets i do need
-
-
Alex J almost 15 yearsWhat errors did you get?
-
Wegged almost 15 yearsi updated the question.