From 5c95a87df56187d4149d4539ff8160593829162d Mon Sep 17 00:00:00 2001 From: Fierelier Date: Mon, 7 Jan 2019 00:20:17 +0100 Subject: [PATCH] Added prevention for rare error --- UniversalModloader.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/UniversalModloader.py b/UniversalModloader.py index 06a5d14..78294b8 100644 --- a/UniversalModloader.py +++ b/UniversalModloader.py @@ -188,7 +188,17 @@ def unloadMods(output = False): if output: print("Can't delete folder! Is it in use?") return - os.rename(originalAppPath,appPath) + + tries = 0 + while tries < 100: + try: + os.rename(originalAppPath,appPath) + tries + 1 + except: + time.sleep(0.1) + else: + tries = 10 + #ctypes.windll.kernel32.SetFileAttributesW(appPath,128) if output: print("\nUnloading mods successful.")