You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
>>> import psutil
>>> psutil.__version__
'0.6.1'
>>> psutil.swap_memory()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/psutil/__init__.py", line 1000,
in swap_memory
return _psplatform.swap_memory()
File "/usr/local/lib/python2.6/dist-packages/psutil/_pslinux.py", line 153,
in swap_memory
f = open("/proc/vmstat", "r")
IOError: [Errno 13] Permission denied: '/proc/vmstat'
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
On what operating system? Is it 32bit or 64bit version?
64 bits
Uh! Interesting.
Why do you consider this to be a bug with psutil though?
The only debatable argument is whether to turn that into an AccessDenied
exception in order to be consistent with psutil.Process class, but other than
that psutil can't and shouldn't do anything about it.
I'm -1 about wrapping all non-process related functions in order to generate
AccessDenied exceptions though.
The chances we get EPERM are very rare, the original OSError exception is
clearer and AccessDenied class is incompatible as it expects a pid and a name
argument [1], both of which refer to a process.
[1] https://code.google.com/p/psutil/source/browse/trunk/psutil/error.py#37
From nicolash...@gmail.com on December 26, 2012 22:12:13
Original issue: http://code.google.com/p/psutil/issues/detail?id=346
The text was updated successfully, but these errors were encountered: