Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debian: Vmstat access error with non root user #346

Closed
giampaolo opened this issue May 23, 2014 · 3 comments
Closed

Debian: Vmstat access error with non root user #346

giampaolo opened this issue May 23, 2014 · 3 comments

Comments

@giampaolo
Copy link
Owner

From nicolash...@gmail.com on December 26, 2012 22:12:13

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

Original issue: http://code.google.com/p/psutil/issues/detail?id=346

@giampaolo
Copy link
Owner Author

From g.rodola on December 27, 2012 19:42:09

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.

@giampaolo
Copy link
Owner Author

From nicolash...@gmail.com on January 18, 2013 08:26:02

Agree with you. PsUtil should generate an error but an internal error like 
psutil.AccessDenied will be better.

Regards

@giampaolo
Copy link
Owner Author

From g.rodola on January 20, 2013 10:58:48

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

Status: WontFix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant