From 2f00a3f29a3cfd099c0d650b2c5c8d1a3908ecab Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 29 Jun 2024 01:03:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=8A=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ica-rs/plugins/base.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ica-rs/plugins/base.py b/ica-rs/plugins/base.py index 4c6a585..cc94364 100644 --- a/ica-rs/plugins/base.py +++ b/ica-rs/plugins/base.py @@ -25,8 +25,11 @@ def local_env_info() -> str: # Python 版本信息 cache.write(f"{platform.python_implementation()}: {platform.python_version()}-{platform.python_branch()}({platform.python_compiler()})\n") # 内存信息 - memory = psutil.virtual_memory() - cache.write(f"内存: {memory.free / 1024 / 1024 / 1024:.3f}GB/{memory.total / 1024 / 1024 / 1024:.3f}GB\n") + try: + memory = psutil.virtual_memory() + cache.write(f"内存: {memory.free / 1024 / 1024 / 1024:.3f}GB/{memory.total / 1024 / 1024 / 1024:.3f}GB\n") + except OSError: + cache.write("内存: 未知\n") return cache.getvalue() def local_env_image() -> bytes: