From d76f6d8161bb6980581eb84af73bc32c33e4a7f9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 1 Apr 2024 12:54:55 +0800 Subject: [PATCH] 2024-03-18, change default values --- settings.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/settings.py b/settings.py index 2a2f492..f3cc978 100644 --- a/settings.py +++ b/settings.py @@ -2890,13 +2890,14 @@ def sync_status_to_extension(status): webdriver_path = os.path.join(Root_Dir, "webdriver") target_path = os.path.join(webdriver_path, CONST_MAXBOT_EXTENSION_NAME) target_path = os.path.join(target_path, "data") - target_path = os.path.join(target_path, CONST_MAXBOT_EXTENSION_STATUS_JSON) - #print("save as to:", target_path) - status_json={} - status_json["status"]=status - #print("dump json to path:", target_path) - with open(target_path, 'w') as outfile: - json.dump(status_json, outfile) + if os.path.exists(target_path): + target_path = os.path.join(target_path, CONST_MAXBOT_EXTENSION_STATUS_JSON) + #print("save as to:", target_path) + status_json={} + status_json["status"]=status + #print("dump json to path:", target_path) + with open(target_path, 'w') as outfile: + json.dump(status_json, outfile) def update_maxbot_runtime_status(): is_paused = False