Try and catch to solve AccessDenied on nice stat on Windows 7

This commit is contained in:
Nicolas Hennion 2012-12-13 12:18:07 +01:00
parent 6a3f774943
commit 73c30932dd

View File

@ -491,7 +491,10 @@ class GlancesGrabProcesses:
if hasattr(proc, 'get_nice'):
# Deprecated in PsUtil 0.5.0+
procstat['nice'] = proc.get_nice()
try:
procstat['nice'] = proc.get_nice()
except psutil.AccessDenied, err:
pass
elif hasattr(proc, 'nice'):
# Else
procstat['nice'] = proc.nice