From 324e3ea12f26fee345ac7c814652a6dcf9154e73 Mon Sep 17 00:00:00 2001 From: Sharrnah <55756126+Sharrnah@users.noreply.github.com> Date: Tue, 24 Dec 2024 20:54:07 +0100 Subject: [PATCH] [BUGFIX] Return correct download status on fallback download --- downloader.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/downloader.py b/downloader.py index d613448..e2cd994 100644 --- a/downloader.py +++ b/downloader.py @@ -83,6 +83,7 @@ def download_extract(urls, extract_dir, checksum, title="", extract_format="", a f.extractall(extract_dir) # remove the zip file after extraction os.remove(local_dl_file) + success = True except Exception as e: print(e) success = False @@ -97,15 +98,18 @@ def download_extract(urls, extract_dir, checksum, title="", extract_format="", a try: download_file_simple(url, extract_dir, checksum) download_successful = True + success = True break # Exit the loop if download is successful except Exception as e: last_exception = e continue # Try the next URL if this one fails if not download_successful: + success = False print("All download attempts failed.") if last_exception: print(f"Last encountered exception: {last_exception}") else: + success = False print(first_exception) if fallback_extract_func is not None: fallback_extract_func(*fallback_extract_func_args)