1
Fork 0
mirror of https://github.com/RGBCube/JsonWrapper synced 2025-07-27 11:47:45 +00:00
This commit is contained in:
RGBCube 2022-01-27 18:55:52 +03:00
parent 89a7e62bd0
commit ca019736eb

View file

@ -33,9 +33,10 @@ class _JsonUtils:
with open(self.json_path, mode="r") as json_file: with open(self.json_path, mode="r") as json_file:
data = json.load(json_file) data = json.load(json_file)
except ValueError: except (FileNotFoundError, ValueError):
with open(self.json_path, mode="w") as json_file: with open(self.json_path, mode="w") as json_file:
json.dump({}, json_file) json.dump({}, json_file)
return
if not isinstance(data, dict): if not isinstance(data, dict):
print("test") print("test")