Skip to content

Commit c3d2d20

Browse files
committed
fix: don't error if progressbar is not installed
1 parent 1183c31 commit c3d2d20

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

scripts/cache.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import subprocess
88
import json
99
import urllib.request
10-
import progressbar
1110
from argparse import ArgumentTypeError
1211
from pathlib import Path
1312
from urllib.parse import urlparse
@@ -81,7 +80,14 @@ def handle_download(output_dir, resource, protocol, url):
8180
if protocol in ('http', 'https', 'ftp'):
8281
info_download(f"Getting web resource {resource}...")
8382
fnurl = Path(urlparse(url).path).stem
84-
urllib.request.urlretrieve(uri, filename=Path(output_dir, fnurl), reporthook=DownloadProgressBar())
83+
try:
84+
import progressbar
85+
urllib.request.urlretrieve(uri, filename=Path(output_dir, fnurl), reporthook=DownloadProgressBar())
86+
except ModuleNotFoundError:
87+
print('Downloading resources....')
88+
urllib.request.urlretrieve(uri, filename=Path(output_dir, fnurl))
89+
print('....done.')
90+
8591
elif protocol in ('docker'):
8692
info_download(f"Getting docker resource {resource}...")
8793
docker_tag = url.split('/')[-1]

0 commit comments

Comments
 (0)