diff --git a/update.py b/update.py index 0dfff297..e55eaa57 100644 --- a/update.py +++ b/update.py @@ -2,6 +2,7 @@ import os import sys import json import re +import shutil def update(): @@ -94,13 +95,14 @@ def update(): num_ok += 1 except Exception as err: try: - print("Error writing: %s. Renaming old file to avoid lock on Windows..." % err) + print("Error writing: %s. Renaming old file as workaround..." % err) path_to_tmp = path_to + "-old" if os.path.isfile(path_to_tmp): os.unlink(path_to_tmp) os.rename(path_to, path_to_tmp) num_rename += 1 open(path_to, 'wb').write(data) + shutil.copymode(path_to_tmp, path_to) # Copy permissions print("Write done after rename!") num_ok += 1 except Exception as err: