From c0118691f42e1926f45775fa802a3fb7babc2898 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 8 Jul 2017 11:04:30 +0200 Subject: [PATCH] PermissionError on macOS #1120 --- NEWS | 1 + glances/processes.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index d20da6bb..0b38ea53 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ Bugs corrected: * Potential memory leak in Windows WebUI (issue #1056) * glances_network `OSError: [Errno 19] No such device` (issue #1106) * GPU plugin. : ... not JSON serializable"> (issue #1112) + * PermissionError on macOS (issue #1120) Installation: diff --git a/glances/processes.py b/glances/processes.py index 27866097..0412358a 100644 --- a/glances/processes.py +++ b/glances/processes.py @@ -240,8 +240,9 @@ class GlancesProcesses(object): procstat.update(proc.as_dict( attrs=['name', 'cpu_times', 'status', 'ppid'], ad_value='')) - except psutil.NoSuchProcess: + except (psutil.NoSuchProcess, psutil.AccessDenied): # Try/catch for issue #432 (process no longer exist) + # Try/catch for issue #1120 (only see on Macos) return None else: procstat['status'] = str(procstat['status'])[:1].upper() @@ -250,7 +251,7 @@ class GlancesProcesses(object): procstat.update(proc.as_dict( attrs=['username', 'cpu_percent', 'memory_percent'], ad_value='')) - except psutil.NoSuchProcess: + except (psutil.NoSuchProcess, psutil.AccessDenied): # Try/catch for issue #432 (process no longer exist) return None