kiranvizru / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

get_open_files() raises private Exception 'psutil._error.AccessDenied' #479

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reproduce -

for proc in psutil.process_iter():
    proc.get_open_files()

Result -
----
Traceback (most recent call last):
  File "/usr/lib/python3.3/site-packages/psutil/_pslinux.py", line 463, in wrapper
    return fun(self, *args, **kwargs)
  File "/usr/lib/python3.3/site-packages/psutil/_pslinux.py", line 908, in get_open_files
    files = os.listdir("/proc/%s/fd" % self.pid)
PermissionError: [Errno 13] Permission denied: '/proc/1/fd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./singleton_script.py", line 6, in <module>
    proc.get_open_files()
  File "/usr/lib/python3.3/site-packages/psutil/__init__.py", line 808, in get_open_files
    return self._platform_impl.get_open_files()
  File "/usr/lib/python3.3/site-packages/psutil/_pslinux.py", line 472, in wrapper
    raise AccessDenied(self.pid, self._process_name)
psutil._error.AccessDenied: (pid=1)
----
Expected a non private error (i.e. no '_error')

Original issue reported on code.google.com by l...@hupfeldtit.dk on 16 Feb 2014 at 4:05

GoogleCodeExporter commented 9 years ago
Agreed. I've been unhappy with this for a while.
2.0.0 is the right chance to change this.

Original comment by g.rodola on 16 Feb 2014 at 5:08

GoogleCodeExporter commented 9 years ago
I killed long deprecated errors.py and _errors.py modules in revision 
c001b5f9a258.
Exception classes now live in "psutil" namespace only.
Closing and thanks. 

Original comment by g.rodola on 16 Feb 2014 at 5:30

GoogleCodeExporter commented 9 years ago
Closing out as fixed as 2.0.0 version is finally out.

Original comment by g.rodola on 10 Mar 2014 at 11:36