From 0bb8d49159b26b78670797d671ef902416552a33 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 18 Jan 2024 20:04:34 -0500 Subject: [PATCH] fix: add exception handling to get amd gpu usage --- pyra/hardware.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyra/hardware.py b/pyra/hardware.py index 9018f4d57..1829bc542 100644 --- a/pyra/hardware.py +++ b/pyra/hardware.py @@ -151,7 +151,10 @@ def update_gpu(): gpu_load = min(100, gpu.query_load()) # max of 100 else: name = f'{gpu.adapterName.decode("utf-8")}-{gpu.adapterIndex}' # adapterName is bytes so decode it - gpu_load = min(100, gpu.getCurrentUsage()) # max of 100 + try: + gpu_load = min(100, gpu.getCurrentUsage()) # max of 100 + except Exception: + gpu_load = None if initialized and name: try: