chanzuckerberg / cryoet-data-portal

CryoET Data Portal
MIT License
19 stars 10 forks source link

Download dialog for datasets has a typo #1309

Open dgmccart opened 2 weeks ago

dgmccart commented 2 weeks ago

Describe the bug The download dialog for datasets causes an error when run as a python script due to the argument given to the download_everything function.

To Reproduce Steps to reproduce the behavior:

  1. Go to dataset 10162

  2. Click on Download Dataset and move to the via API tab

  3. Copy and paste the code and save it as a python script

    Screenshot 2024-11-05 at 3 17 12 PM
  4. Run the script and see the following error

    0%|                                                                                                                             | 0.00/7.65G [00:00<?, ?iB/s]
    Traceback (most recent call last):
    File "/Users/dmccarthy/Downloads/test_download.py", line 6, in <module>
    dataset.download_everything('10162')
    File "/opt/miniconda3/envs/cryoet/lib/python3.12/site-packages/cryoet_data_portal/_models.py", line 105, in download_everything
    download_directory(self.s3_prefix, recursive_prefix, dest_path)
    File "/opt/miniconda3/envs/cryoet/lib/python3.12/site-packages/cryoet_data_portal/_file_tools.py", line 106, in download_directory
    local_file = get_destination_path(
                 ^^^^^^^^^^^^^^^^^^^^^
    File "/opt/miniconda3/envs/cryoet/lib/python3.12/site-packages/cryoet_data_portal/_file_tools.py", line 65, in get_destination_path
    raise ValueError("Recursive downloads require a base directory")
    ValueError: Recursive downloads require a base directory

    Removing the argument to download everything fixes the problem, resulting in the dataset being downloaded in the current working directory. Correct code:

    
    from cryoet_data_portal import Client, Dataset

client = Client()

dataset = Dataset.get_by_id(client, 10162) dataset.download_everything()