From 744ea937fb856d608f101ed341a44c78867c7b9b Mon Sep 17 00:00:00 2001 From: John Bauer Date: Fri, 3 Jan 2025 23:06:44 -0800 Subject: [PATCH] file_size is only used for making a pretty tqdm, so make it so the download succeeds even if it isn't present. https://github.com/stanfordnlp/stanza/issues/1442 --- stanza/resources/common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stanza/resources/common.py b/stanza/resources/common.py index 0a0c1263fa..81fc7c2c6a 100644 --- a/stanza/resources/common.py +++ b/stanza/resources/common.py @@ -120,7 +120,9 @@ def download_file(url, path, proxies, raise_for_status=False): if raise_for_status: r.raise_for_status() with open(path, 'wb') as f: - file_size = int(r.headers.get('content-length')) + file_size = r.headers.get('content-length', None) + if file_size: + file_size = int(file_size) default_chunk_size = 131072 desc = 'Downloading ' + url with tqdm(total=file_size, unit='B', unit_scale=True, \