Skip to content

Commit 4a40d64

Browse files
authored
now creating folder if it doesn't exist (#1066)
1 parent 69f30dc commit 4a40d64

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/squidpy/datasets/_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ def _extension(self) -> str:
185185
def _get_zipped_dataset(folderpath: Path, dataset_name: str, figshare_id: str) -> sd.SpatialData:
186186
"""Returns a specific dataset as SpatialData object. If the file is not present on disk, it will be downloaded and extracted."""
187187

188-
if not folderpath.is_dir():
188+
# Create directory if it doesn't exist
189+
if not folderpath.exists():
190+
logg.info(f"Creating directory `{folderpath}`")
191+
folderpath.mkdir(parents=True, exist_ok=True)
192+
elif not folderpath.is_dir():
189193
raise ValueError(f"Expected a directory path for `folderpath`, found: {folderpath}")
190194

191195
download_zip = folderpath / f"{dataset_name}.zip"

0 commit comments

Comments
 (0)