Skip to content

Commit f5b272b

Browse files
authored
fix: also create parents during export directory creation (#197)
If the export directory doesn't exist, it will be created. However, this fails if the parent also doesn't exist (e.g `data/steel/output/transience/pickle` will fail if there is no transcience folder yet). This is fixed here. In a follow-up, one could probably migrate more of the older `os.path` functions to use `Path`.
1 parent 6d874db commit f5b272b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎remind_mfa/common/common_export.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def export_path(self, dataset: str, filename: str | None = None) -> str:
364364

365365
base_dir = os.path.join(*path_tuple)
366366
if not os.path.isdir(base_dir):
367-
os.mkdir(base_dir)
367+
Path(base_dir).mkdir(parents=True, exist_ok=True)
368368

369369
if filename is not None:
370370
path_tuple += (filename,)

0 commit comments

Comments
 (0)