From 890c67c5fffdb46d6e7a61f1df864c8e78c97d78 Mon Sep 17 00:00:00 2001 From: Wizzard Date: Tue, 23 Jan 2024 15:04:30 -0500 Subject: [PATCH] If directory already exists, delete before extraction to ensure no errors --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index 3b3b7e6..79d47ed 100644 --- a/main.py +++ b/main.py @@ -49,6 +49,9 @@ def is_new_version_available(local_version_path, server_version_url): return False def unzip_file(zip_path, extract_to_path): + if extract_to_path.exists(): + shutil.rmtree(extract_to_path) + extract_to_path.mkdir(parents=True, exist_ok=True) with zipfile.ZipFile(zip_path, 'r') as zip_ref: zip_ref.extractall(extract_to_path)