From a2849c1bcd9b162863415450b074dc1ff2fc7c7c Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Tue, 28 Feb 2017 16:13:01 +0100 Subject: [PATCH] Added a catch for psutils if process get stopped by user --- bin/ModulesInformationV2.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/ModulesInformationV2.py b/bin/ModulesInformationV2.py index b43edeb7..09a0fa85 100755 --- a/bin/ModulesInformationV2.py +++ b/bin/ModulesInformationV2.py @@ -644,6 +644,12 @@ def fetchQueueData(): if len(CPU_TABLE[moduleNum]) > args.refresh*10: CPU_TABLE[moduleNum].pop() mem_percent = CPU_OBJECT_TABLE[int(moduleNum)].memory_percent() + except psutil.NoSuchProcess: + del CPU_OBJECT_TABLE[int(moduleNum)] + del CPU_TABLE[moduleNum] + cpu_percent = 0 + cpu_avg = cpu_percent + mem_percent = 0 except KeyError: try: CPU_OBJECT_TABLE[int(moduleNum)] = psutil.Process(int(moduleNum))