From f8f857c820d4cca4c5333b19709ba7434d716a44 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Wed, 27 Mar 2019 03:12:02 +0100 Subject: [PATCH] Fix atomicWrite non existing tmpold removal --- src/util/helper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/helper.py b/src/util/helper.py index 547fcd40..77d3aa03 100644 --- a/src/util/helper.py +++ b/src/util/helper.py @@ -23,7 +23,8 @@ def atomicWrite(dest, content, mode="wb"): if os.path.isfile(dest): # Rename old file to -tmpold os.rename(dest, dest + "-tmpold") os.rename(dest + "-tmpnew", dest) - os.unlink(dest + "-tmpold") # Remove old file + if os.path.isfile(dest + "-tmpold"): + os.unlink(dest + "-tmpold") # Remove old file return True except Exception as err: from Debug import Debug