summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2022-10-16 10:12:38 +0800
committerKyomotoi <[email protected]>2022-10-16 10:12:38 +0800
commit9ee2cde30d99decdea2b4a01c7bf2bc7cee0e128 (patch)
tree86effc920ed6c68dabe1f6b556a822f7c7cc210a
parent81d7b6138d26bcf144ad78b068e9d604f7a50d46 (diff)
downloadATRI-9ee2cde30d99decdea2b4a01c7bf2bc7cee0e128.tar.gz
ATRI-9ee2cde30d99decdea2b4a01c7bf2bc7cee0e128.tar.bz2
ATRI-9ee2cde30d99decdea2b4a01c7bf2bc7cee0e128.zip
🐛 添加无法找到文件的判断
-rw-r--r--ATRI/plugins/console/driver/api.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/ATRI/plugins/console/driver/api.py b/ATRI/plugins/console/driver/api.py
index acdf521..4750148 100644
--- a/ATRI/plugins/console/driver/api.py
+++ b/ATRI/plugins/console/driver/api.py
@@ -51,7 +51,7 @@ def get_processing_data() -> tuple:
PlatformRuntimeInfo(
stat_msg=msg,
cpu_percent=str(p_cpu),
- mem_percent=p_mem,
+ mem_percent=str(p_mem),
disk_percent=str(disk),
inte_send=str(inte_send),
inte_recv=str(inte_recv),
@@ -138,13 +138,18 @@ MANEGE_DIR = Path(".") / "data" / "plugins" / "manege"
def get_block_list() -> dict:
+ u_data = dict()
+ g_data = dict()
+
u_f = "block_user.json"
path = MANEGE_DIR / u_f
- u_data = json.loads(path.read_bytes())
+ if path.is_file():
+ u_data = json.loads(path.read_bytes())
g_f = "block_group.json"
path = MANEGE_DIR / g_f
- g_data = json.loads(path.read_bytes())
+ if path.is_file():
+ g_data = json.loads(path.read_bytes())
return {"user": u_data, "group": g_data}