aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/PCbuild/get_external.py
diff options
context:
space:
mode:
Diffstat (limited to 'PCbuild/get_external.py')
-rwxr-xr-xPCbuild/get_external.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/PCbuild/get_external.py b/PCbuild/get_external.py
index 8c1155c74a6..a78aa6a2304 100755
--- a/PCbuild/get_external.py
+++ b/PCbuild/get_external.py
@@ -5,8 +5,9 @@ import os
import pathlib
import sys
import time
+import urllib.error
+import urllib.request
import zipfile
-from urllib.request import urlretrieve
def retrieve_with_retries(download_location, output_path, reporthook,
@@ -14,12 +15,12 @@ def retrieve_with_retries(download_location, output_path, reporthook,
"""Download a file with exponential backoff retry and save to disk."""
for attempt in range(max_retries + 1):
try:
- resp = urlretrieve(
+ resp = urllib.request.urlretrieve(
download_location,
output_path,
reporthook=reporthook,
)
- except ConnectionError as ex:
+ except (urllib.error.URLError, ConnectionError) as ex:
if attempt == max_retries:
msg = f"Download from {download_location} failed."
raise OSError(msg) from ex