Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,5 +410,9 @@ def write_json_file(data, path):
path_backup = path + '.bkp'
with open(path_temp, 'w') as f:
f.write(json.dumps(data)) # write to temp file to ensure no data loss if exception raised here
try:
os.remove(path_backup)
except OSError:
pass
os.rename(path, path_backup) # create backup file in case rename is unsuccessful
os.rename(path_temp, path)