Questions tagged [psutil]

psutil (python system and process utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network) in Python.

psutil (process and system utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network) in Python. It is useful mainly for system monitoring, profiling and limiting process resources and management of running processes. It implements many functionalities offered by command line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free, nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It currently supports Linux, Windows, OSX, Sun Solaris, FreeBSD, OpenBSD and NetBSD, both 32-bit and 64-bit architectures, with Python versions from 2.6 to 3.5.

Resources:

481 questions
0
votes
1 answer

Python psutil collect process resources usage on Mac OS X

Apparently I can't get the process resources usage in Mac OS X with psutil after the process got reaped, i.e. after p.wait() where p is a psutil.Popen() instance. So for example, if I try ps.cpu_times().system where ps is a psutil.Process()…
C. Porto
  • 631
  • 3
  • 12
  • 26
0
votes
1 answer

Trying to find if a process is alive in Python

I'm using psutil in order to know when a process is running. So far I have this code: PROCESS_NAME = 'python.exe' for p in psutil.process_iter(): if p.name == PROCESS_NAME: print("It's alive!") break However, it doesn't seem to work. I've…
Andrei P.
  • 302
  • 3
  • 9
0
votes
1 answer

OSX10.9 App crashes: Symbol not found: ___strlcat_chk

I have an application that works perfectly with my MacBook (Mavericks). After trying it with a virtual machine (OSX Lion), it crashes with this Traceback: Mac-OS-X-Lion AppleFileServer[219]: _Assert:…
FBruynbroeck
  • 499
  • 3
  • 15
0
votes
3 answers

Error with sending Ints/Strings from Python via PySerial

I'm trying to build a CPU Monitor with Python and Arduino. Arduino works fine, but I'm having problems with Python. My Problem is that I cant get PySerial to send out a int or a string. If I try to send a Int I get: TypeError: 'int' object is not…
Fridoku
  • 1
  • 1
-1
votes
0 answers

How to get network IO of a process in python

I am trying to get the network IO status of a specific process in python. Currently I am using psutil, netio = psutil.net_io_counters() But this above code is for all the network sent and receive packages. I want the status for a specific process,…
Kaung Zan
  • 1
  • 1
-1
votes
1 answer

Python: how to avoid psutil.process_iter() 'AccessDenied' and other misc errors?

In Python, why am I seeing psutil.AccessDenied errors/exceptions when iterating through my processes (which works just fine) and printing their command lines via psutil.cmdline() (which, frustratingly experiences the aforementioned Exception for the…
Johnny Utahh
  • 2,389
  • 3
  • 25
  • 41
-1
votes
1 answer

When i try to use the code inside a function, it doesn´t work, Python

The scrip is about getting the use of my bandwidth, real-time. The code works by itself, but when i try to return data from a function, it breaks, and return wrong data. Thanks for your help. This is my code without beeing in a funtion: import…
Momosno
  • 13
  • 3
-1
votes
1 answer

how to get cpu stats every 15 seconds ? python

see i am using import psutil d = psutil.cpu_percent(1.5) e = psutil.cpu_percent(1.5) f = psutil.cpu_percent(1.5) g = psutil.cpu_percent(1.5) val = (d + e +f+g)/4 print(d , e , f, g) print(val) when I used…
codery
  • 9
  • 3
-1
votes
2 answers

Check every X-milliseconds if process/application is running on Win

i want to check every 500 milliseconds if a process/application is running (Windows 10). The code should be very fast and resource efficient! My Code is this but how to build the 500 milliseconds in. Is psutil the fastest and best way? Thank…
gerrard87
  • 45
  • 5
-1
votes
2 answers

ValueError: Image generation requires the psutil package. Install using pip: $ pip install psutil yet requirement already satisfied?

I am trying to save a plotly static graph using the following command: graph.write_image("test.png") However I get the following error: ValueError: Image generation requires the psutil package. Install using pip: $ pip install psutil However I…
geds133
  • 1,503
  • 5
  • 20
  • 52
-1
votes
1 answer

Trouble casting string to NamedTuple

I am trying to parse a string rep of a NamedTuple for connection parameters generated remotely by the psutil library (process.connections()) The string looks like this: pconn(fd=-1, family=, type=
Bill
  • 618
  • 6
  • 15
-1
votes
1 answer

Running else loop once

So i have a script with the code import os import subprocess import psutil def checkIfProcessRunning(processName): ''' Check if there is any running process that contains the given name processName. ''' #Iterate over the all the running process for…
PackedUP32
  • 17
  • 4
-1
votes
1 answer

Visual studio says psutil module not found even though it's installed

I've got a problem with using psutil in python project. Psutil is installed, but visual studio still says it's not found. Any ideas why it's not working? I'm using Win 10 and Visual Studio 16.8.1 and python 3.9 Edit: I tried all of these: Edit…
-1
votes
1 answer

How to detect Created Exe's created another exe is closed?

For example, we have 2 executable files on windows. (EXE_1.exe, EXE_2.exe) EXE_1.exe is calling EXE_2.exe with arguments. I want to detect when EXE_2 Closed(Terminated, killed etc.) I can't use WaitForSingleObject in C++ or Psutil process wait in…
Emrexdy
  • 156
  • 1
  • 2
  • 8
-1
votes
1 answer

Windows 10 default services

Is it possible to filter the windows services using python. import psutil psutil.process_iter() I could get all running services by using psutil Is there any way to filter windows service from the list of services.
Vineesh TP
  • 7,755
  • 12
  • 66
  • 130