fix
This commit is contained in:
parent
10c051a8a1
commit
173c87ea48
@ -50,12 +50,15 @@ def save_session(session_file, wxid, arg, value):
|
|||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
logging.error(f"Error decoding JSON file: {e}")
|
logging.error(f"Error decoding JSON file: {e}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if wxid not in session:
|
if wxid not in session:
|
||||||
session[wxid] = {}
|
session[wxid] = {}
|
||||||
|
if not isinstance(session[wxid], dict):
|
||||||
|
session[wxid] = {}
|
||||||
session[wxid][arg] = value
|
session[wxid][arg] = value
|
||||||
try:
|
try:
|
||||||
with open(session_file, 'w') as f:
|
with open(session_file, 'w') as f:
|
||||||
json.dump(session, f, indent=4)
|
json.dump(session, f, indent=4, ensure_ascii=False)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error writing to file: {e}")
|
logging.error(f"Error writing to file: {e}")
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user