Menu
  • HOME
  • TAGS

Not able to use psutil.Process()

python,psutil

You have to use p.name instead of p.name() when using psutil in version 1.2.1. In version 2.X you can use p.name() (https://pythonhosted.org/psutil/#psutil.Process.name). >>> p=psutil.Process(21443) >>> p.name 'kworker/0:1' >>> p.name() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'str' object is not callable ...

unable to update python package psutil

python,debian,psutil

remove all versions of psutil and install 2.2.1 again: $ sudo pip uninstall psutil Uninstalling psutil: /usr/local/lib/python2.7/dist-packages/_psutil_linux.so /usr/local/lib/python2.7/dist-packages/_psutil_posix.so /usr/local/lib/python2.7/dist-packages/psutil /usr/local/lib/python2.7/dist-packages/psutil-2.2.1.egg-info Proceed (y/n)? y Successfully uninstalled psutil $ sudo apt-get remove --purge python-psutil Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED:...

python system idle/inactive without using ctypes - platform independent as well

python,time,python-idle,psutil

I managed to get ctypes to work (well...without crashing python that is :-) ) and so now I am able to use this solution from SO And thanks to FogleBird for the above solution In the process of tackling this problem I learnt about psutil which I think can benefit...

Python's psutil module and a bizarre issue

python,windows,process,psutil

Not all of the information from each process will be available to you unless you are the root user/administrator. See this question: python psutil on windows gives access denied. You would be better off changing your first example to specifically catch these cases, with: try: if str(psutil.Process(pid).name()) == name: return...

psutil module in python

python,psutil

No. kill is a method called on a process object, so it is a question of finding the right process. You might iterate through them: for proc in psutil.process_iter(): try: print("{:4d} {:4d} {:s}". format(proc.pid, proc.ppid, proc.exe)) except psutil.AccessDenied: pass except psutil.NoSuchProcess as err: print("****",err) The example exception handling is to...

Strange behavior of psutil

python,ubuntu-14.04,psutil

Measuring memory occupation is like taking a picture of someone in movement. The ps utils do not always see the same size of your script+variables, a some of the parts are not always visible. Classes get instantiated and are then destroyed. Variables are allocated, then freed again. As the documentation...

Find the path of every running process in Python

python,windows,process,path,psutil

As an administrator you might be able to get PROCESS_QUERY_LIMITED_INFORMATION (0x1000) access for a given process if you can't get PROCESS_QUERY_INFORMATION (0x400). QueryFullProcessImageNameW only requires limited access. However, not even this will work in all cases. For example, the security descriptor on csrss.exe only grants access to the SYSTEM account,...

What is the meaning of every paramater returned by psutil.cpu_times() in python?

python,psutil

Those are cumulative numbers therefore they represent the amount of time the CPU has spent since the system has started. As for the meaning of each value (idle, iowait, etc.) take a look at "man proc": cpu 3357 0 4313 1362393 The amount of time, measured in units of USER_HZ...

psutil can not be found within a flask project

python,psutil

Does your first line in satelite.py refers to the same python binary as which python in your terminal ? (This refer to the #! line) Maybe you are using python3 in your satelite.py file....

Are disk_io_counters accumulative

python,python-3.x,psutil

On Linux, those counters get their data from the /proc/diskstats file. See https://www.kernel.org/doc/Documentation/iostats.txt for more. They are cumulative and reset when they overflow or the disk that they pertain to is removed or when the computer resets. I can't find a source to support that last statement but it is...

OSX10.9 App crashes: Symbol not found: ___strlcat_chk

python,xcode,osx,pyobjc,psutil

Your answer is right there in the dump: _psutil_osx.so (from /Users/user/Public/Drop Box/SafeDrive.app/Contents/Resources/) is missing the symbol strlcat_chk which it is trying to import from libSystem.B, during runtime using dlopen(). The _Chk variant is a safer version of strlcat (a string concatenation function) which checks its arguments for buffer overflows. Apps...

How to get the percentage of memory usage of a process?

python,linux,psutil

use process.memory_percent() This agrees with top. In the test script below, you can change the argument to the range function defining the consume_memory array, which is only there to use up memory for testing, and both python output and top output will match: import os import psutil def memory_usage_psutil(): #...

python psutil psutil.get_process_list() error

python,psutil

After checking the documentation here , I do not see a get_process_list() function in psutil, it has been deprecated according to this . Maybe you should try the function - process_iter() - documentation here It yields an iterator that would return all the processes in the system as Process class...

How to obtain the real number of file descriptors used by this process with psutil?

python,psutil

The reason is that open_files() returns regular files only but a process may open many other kinds of fds (sockets, pipes, etc). A tool like lsof reports all of them. I decided not to do the same in psutil because it's too complex, too low level and not portable by...

Find if process is running in Windows psutil

python,windows,psutil

Here is the modified version that worked for me on Windows 7 with python v2.7 You were doing it in a wrong way here if proc.name == process_name: in your code. Try to print proc.name and you'll notice why your code didn't work as you were expecting. Code: import psutil...

Python 3.4 Installing psutil on Windows 7 x64

python,psutil

vcvarsall.bat looks like a dependency for Microsoft Visual Studio. See: Python issue:Unable to find vcvarsall.bat You could try to install it manually. Get the amd64 py3.4 build from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#psutil And install it. If that fails as well, use 7-Zip to open the .exe and unpack the contained folder to...

read files from linux usb drive under Windows

python,python-3.x,psutil

How is your drive formatted? Windows can only read ntfs and fat formats. You can check this using the windows disk management tool: From http://pcsupport.about.com/od/windows7/ht/disk-management-windows-7.htm: How To Access Disk Management in Windows 7 Click on the Start button and then choose Control Panel. Click on the System and Security link....

Memory usage of a single process with psutil in python (in byte)

memory,process,psutil

Call memory_info_ex: >>> import psutil >>> p = psutil.Process() >>> p.name() 'python.exe' >>> _ = p.memory_info_ex() >>> _.wset, _.pagefile (11665408, 8499200) The working set includes pages that are shared or shareable by other processes, so in the above example it's actually larger than the paging file commit charge. There's also...