From eb00284896311c6b0295ad90b30bf6d1fb3e6785 Mon Sep 17 00:00:00 2001 From: "Mikhail f. Shiryaev" Date: Wed, 27 Sep 2023 18:24:56 +0200 Subject: [PATCH] Fix DownloadException --- tests/ci/build_download_helper.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/ci/build_download_helper.py b/tests/ci/build_download_helper.py index 6354834f0b1..b76c5433142 100644 --- a/tests/ci/build_download_helper.py +++ b/tests/ci/build_download_helper.py @@ -144,18 +144,18 @@ def download_build_with_progress(url: str, path: Path) -> None: sys.stdout.write(f"\r[{eq_str}{space_str}] {percent}%") sys.stdout.flush() break - except Exception: + except Exception as e: if sys.stdout.isatty(): sys.stdout.write("\n") - if i + 1 < DOWNLOAD_RETRIES_COUNT: - time.sleep(3) - if os.path.exists(path): os.remove(path) - else: - raise DownloadException( - f"Cannot download dataset from {url}, all retries exceeded" - ) + + if i + 1 < DOWNLOAD_RETRIES_COUNT: + time.sleep(3) + else: + raise DownloadException( + f"Cannot download dataset from {url}, all retries exceeded" + ) from e if sys.stdout.isatty(): sys.stdout.write("\n")