Commit 0d09f38a authored by Frank te Nijenhuis's avatar Frank te Nijenhuis
Browse files

Simple fix of issue 248, environment variables are now always expanded when...

Simple fix of issue 248, environment variables are now always expanded when used as a dir_path argument
parent 8032b8d2
...@@ -180,6 +180,9 @@ def unpack_dataset(folder: Pathlike, ...@@ -180,6 +180,9 @@ def unpack_dataset(folder: Pathlike,
""" """
logger.info("Unpacking dataset") logger.info("Unpacking dataset")
npz_files = subfiles(Path(folder), identifier="*.npz", join=True) npz_files = subfiles(Path(folder), identifier="*.npz", join=True)
if not npz_files:
logger.warning(f'No paths found in {Path(folder)} matching *.npz')
return
with Pool(processes) as p: with Pool(processes) as p:
p.starmap(npz2npy, zip(npz_files, repeat(delete_npz))) p.starmap(npz2npy, zip(npz_files, repeat(delete_npz)))
......
...@@ -34,7 +34,7 @@ def subfiles(dir_path: Path, identifier: str, join: bool) -> List[str]: ...@@ -34,7 +34,7 @@ def subfiles(dir_path: Path, identifier: str, join: bool) -> List[str]:
Returns: Returns:
List[str]: found paths/file names List[str]: found paths/file names
""" """
paths = list(map(str, list(Path(dir_path).glob(identifier)))) paths = list(map(str, list(Path(os.path.expandvars(dir_path)).glob(identifier))))
if not join: if not join:
paths = [p.rsplit(os.path.sep, 1)[-1] for p in paths] paths = [p.rsplit(os.path.sep, 1)[-1] for p in paths]
return paths return paths
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment