Skip to content

Commit

Permalink
fail with better error message on broken downloads
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Kümmerer <[email protected]>
  • Loading branch information
matthias-k committed Aug 14, 2024
1 parent c1289f2 commit fc6f096
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pysaliency/external_models/matlab_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ def __init__(self, location=None, **kwargs):

def _setup(self):
source_location = os.path.join(self.location, 'gbvs')
download_extract_patch('http://www.vision.caltech.edu/~harel/share/gbvs.zip',
url = "http://www.vision.caltech.edu/~harel/share/gbvs.zip"

download_extract_patch(url,
'c5a86b9549c2c0bbd1b7f7e5b663b031',
source_location,
location_in_archive=True,
Expand Down
2 changes: 2 additions & 0 deletions pysaliency/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ def download_file(url, target, verify_ssl=True):
for data in r.iter_content(32*1024):
f.write(data)
progress_bar.update(32*1024)
if r.status_code in [403, 404, 500, 503]:
raise ValueError("Error downloading file from {}. Status code: {}".format(url, r.status_code))


def download_and_check(url, target, md5_hash, verify_ssl=True):
Expand Down

0 comments on commit fc6f096

Please sign in to comment.