Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parameter filepath of download_and_extract #5463

Open
wyli opened this issue Nov 3, 2022 · 0 comments · May be fixed by #8216
Open

parameter filepath of download_and_extract #5463

wyli opened this issue Nov 3, 2022 · 0 comments · May be fixed by #8216
Labels

Comments

@wyli
Copy link
Contributor

wyli commented Nov 3, 2022

Describe the bug

>>> import monai
>>> url = "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/MedNIST.tar.gz"

>>> monai.apps.utils.download_and_extract(url, filepath=".")
2022-11-03 15:15:04,858 - INFO - Expected md5 is None, skip md5 check for file ..
2022-11-03 15:15:04,858 - INFO - File exists: ., skipped downloading.
2022-11-03 15:15:04,858 - INFO - Non-empty folder exists in ., skipped extracting.

>>> monai.apps.utils.download_and_extract(url, filepath="./test")
test: 59.0MB [00:09, 6.22MB/s]                                                                                                                                                                                     
2022-11-03 15:16:23,355 - INFO - Downloaded: test
2022-11-03 15:16:23,356 - INFO - Expected md5 is None, skip md5 check for file test.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Documents/MONAI/monai/apps/utils.py", line 313, in download_and_extract
    extractall(filepath=filename, output_dir=output_dir, file_type=file_type, has_base=has_base)
  File "/Users/Documents/MONAI/monai/apps/utils.py", line 256, in extractall
    if cache_dir.exists() and next(cache_dir.iterdir(), None) is not None:
  File "/usr/local/anaconda3/envs/py38/lib/python3.8/pathlib.py", line 1122, in iterdir
    for name in self._accessor.listdir(self):
NotADirectoryError: [Errno 20] Not a directory: 'test'

it's not easy to set a valid filepath for download_and_extract and the error messages are not very intuitive.

would be great if the argument can be used to cache the downloaded file easily

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant