Skip to content

error downloading file from sub-directory in zenodo repository #336

@djmannion

Description

@djmannion

Description of the problem:

Thanks very much for this very useful project!

I'm trying to download a file from the zenodo repository at doi:10.5281/zenodo.7352326 (link). The file name is GreatApeDictionary-v1.1.zip and it seems to be in a Wild-Minds sub-directory in the repository. I receive an error that the file is "not found in data archive" (see below for full error message).

Looking in the pooch/downloaders.py code (v1.6.0), it seems that the files information that is returned by the zenodo API has the filename as Wild-Minds/GreatApeDictionary-v1.1.zip - but the file name that is passed to the downloader is the last item of a split("/") operation and so loses the Wild-Milds part. If I replace the line file_name=parsed_url["path"].split("/")[-1], with file_name="/".join(parsed_url["path"].split("/")[1:]), then it seems to work fine.

I noticed that the code has changed in the current git version, so I tried that also (v1.6.0.post16+gf20fe3a). I get a different error: ValueError: Archive with doi:10.5281/zenodo.7347607/Wild-Minds not found (see https://doi.org/10.5281/zenodo.7347607/Wild-Minds). Is the DOI correct? - so the sub-directory seems to be being included as part of the DOI.

Apologies if I have just missed something - thanks for any assistance.

Full code that generated the error

raw_data_path = pooch.retrieve(
    url="doi:10.5281/zenodo.7347607/Wild-Minds/GreatApeDictionary-v1.1.zip",
    known_hash="md5:8c40d1bce25619548f4daa16d63f36a3",
)

Full error message

Downloading data from 'doi:10.5281/zenodo.7347607/Wild-Minds/GreatApeDictionary-v1.1.zip' to file '/home/damien/.cache/pooch/66afcc98f960ee876a64b8ab89dbec3e-GreatApeDictionary-v1.1.zip'.
Traceback (most recent call last):
  File "/home/damien/venv_study/ape_gestures/code/ape_gestures/ape_gestures/data.py", line 15, in <module>
    get_raw_data_path()
  File "/home/damien/venv_study/ape_gestures/code/ape_gestures/ape_gestures/data.py", line 6, in get_raw_data_path
    raw_data_path = pooch.retrieve(
  File "/home/damien/venv/ape_gestures/lib/python3.9/site-packages/pooch/core.py", line 240, in retrieve
    stream_download(url, full_path, known_hash, downloader, pooch=None)
  File "/home/damien/venv/ape_gestures/lib/python3.9/site-packages/pooch/core.py", line 772, in stream_download
    downloader(url, tmp, pooch)
  File "/home/damien/venv/ape_gestures/lib/python3.9/site-packages/pooch/downloaders.py", line 573, in __call__
    download_url = converters[repository](
  File "/home/damien/venv/ape_gestures/lib/python3.9/site-packages/pooch/downloaders.py", line 633, in zenodo_download_url
    raise ValueError(
ValueError: File 'GreatApeDictionary-v1.1.zip' not found in data archive https://zenodo.org/record/7352326 (doi:10.5281/zenodo.7347607).

System information

  • Operating system: Linux
  • Python installation (Anaconda, system, ETS): System
  • Version of Python: 3.9.16
  • Version of this package: 1.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReport a problem that needs to be fixed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions