From a7d56a5f20a958eb0526c3191bad51556dad5783 Mon Sep 17 00:00:00 2001 From: yeggor Date: Mon, 29 Apr 2024 15:09:50 +0100 Subject: [PATCH] handle exception for psutil.NoSuchProcess along with psutil.AccessDenied --- memory_profiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory_profiler.py b/memory_profiler.py index f0b52cd..de12396 100644 --- a/memory_profiler.py +++ b/memory_profiler.py @@ -144,7 +144,7 @@ def ps_util_tool(): return mem, time.time() else: return mem - except psutil.AccessDenied: + except (psutil.NoSuchProcess, psutil.AccessDenied): pass # continue and try to get this from ps