Unverified 提交 1a2eb532 authored 作者: Aarni Koskela's avatar Aarni Koskela 提交者: GitHub

Fix return value check for subprocess.run (#10972)

Subprocess.run does not return an integer. Regressed in #10944
上级 fa4bdbe1
...@@ -631,8 +631,8 @@ def download(url, dir='.', unzip=True, delete=True, curl=False, threads=1, retry ...@@ -631,8 +631,8 @@ def download(url, dir='.', unzip=True, delete=True, curl=False, threads=1, retry
for i in range(retry + 1): for i in range(retry + 1):
if curl: if curl:
s = 'sS' if threads > 1 else '' # silent s = 'sS' if threads > 1 else '' # silent
r = subprocess.run(f'curl -# -{s}L "{url}" -o "{f}" --retry 9 -C -'.split()) proc = subprocess.run(f'curl -# -{s}L "{url}" -o "{f}" --retry 9 -C -'.split())
success = r == 0 success = proc.returncode == 0
else: else:
torch.hub.download_url_to_file(url, f, progress=threads == 1) # torch download torch.hub.download_url_to_file(url, f, progress=threads == 1) # torch download
success = f.is_file() success = f.is_file()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论