Skip to content

Commit

Permalink
file_size is only used for making a pretty tqdm, so make it so the do…
Browse files Browse the repository at this point in the history
…wnload succeeds even if it isn't present. #1442
  • Loading branch information
AngledLuffa committed Jan 4, 2025
1 parent 7155379 commit 744ea93
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stanza/resources/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down

0 comments on commit 744ea93

Please sign in to comment.