catch dwl data parsing error

This commit is contained in:
piotr
2021-10-26 02:24:03 +02:00
parent 592eb84697
commit af3dfbc740
2 changed files with 10 additions and 5 deletions

View File

@@ -115,11 +115,16 @@ def check_tree():
def check_dwl_data():
global dwl_timestamp
ts = os.path.getmtime(common.dwl_data_file)
try:
ts = os.path.getmtime(common.dwl_data_file)
except Exception as e:
ts = 0
print("Exception getting timestamp: {}".format(e))
if ts > dwl_timestamp:
common.dwl_data = load_json(common.dwl_data_file)
print(common.dwl_data)
dwl_timestamp = ts
if common.dwl_data:
print(common.dwl_data)
dwl_timestamp = ts
return True

View File

@@ -201,8 +201,8 @@ def load_json(path):
with open(path, 'r') as f:
return json.load(f)
except Exception as e:
print(e)
sys.exit(1)
print("Error loading json: {}".format(e))
return None
def save_json(src_dict, path):