From 64eee8cb9cfad9ef5bd3eaf597fef0fbe85144b4 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:49:57 +0800 Subject: [PATCH] Fix FileNotFoundError when download bundle (#8076) Fixes #8075 ### Types of changes - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- monai/bundle/scripts.py | 1 + 1 file changed, 1 insertion(+) diff --git a/monai/bundle/scripts.py b/monai/bundle/scripts.py index f1d1286e4b..f31ad0e814 100644 --- a/monai/bundle/scripts.py +++ b/monai/bundle/scripts.py @@ -255,6 +255,7 @@ def _download_from_ngc_private( else: raise ValueError("NGC API requires requests package. Please install it.") + os.makedirs(download_path, exist_ok=True) zip_path = download_path / f"{filename}_v{version}.zip" with open(zip_path, "wb") as f: f.write(response.content)