未验证 提交 651dab4a 编写于 作者: H hong 提交者: GitHub

Catch exception in download (#28090)

* cat exeception in request download; test=develop

* add re-try in download; test=develop
上级 8327accc
......@@ -88,6 +88,7 @@ def download(url, module_name, md5sum, save_name=None):
sys.stderr.write("Cache file %s not found, downloading %s \n" %
(filename, url))
sys.stderr.write("Begin to download\n")
try:
r = requests.get(url, stream=True)
total_length = r.headers.get('content-length')
......@@ -109,6 +110,9 @@ def download(url, module_name, md5sum, save_name=None):
if log_index % log_interval == 0:
sys.stderr.write(".")
sys.stdout.flush()
except Exception as e:
# re-try
continue
sys.stderr.write("\nDownload finished\n")
sys.stdout.flush()
return filename
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册