From 5c6d21e9cfaaffae20ac3f87bc9225b1ef9ca1d6 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 9 Nov 2022 17:30:31 -0500 Subject: [PATCH] only create subdir when dataset --- python/damask/_result.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index fe2041cd8..95dbd9fd3 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1986,17 +1986,14 @@ class Result: cfg = cfg_dir/name - if type(obj) == h5py.Dataset and _match(output,name): - d = obj.attrs['description'] if h5py3 else obj.attrs['description'].decode() + if type(obj) == h5py.Dataset and _match(output,[name]): if cfg.exists() and not overwrite: raise PermissionError(f'"{cfg}" exists') else: + cfg.parent.mkdir(parents=True,exist_ok=True) with util.open_text(cfg,'w') as f_out: f_out.write(obj[0].decode()) - elif type(obj) == h5py.Group: - cfg.mkdir(parents=True,exist_ok=True) cfg_dir = (Path.cwd() if target_dir is None else Path(target_dir)) - cfg_dir.mkdir(parents=True,exist_ok=True) with h5py.File(self.fname,'r') as f_in: f_in['setup'].visititems(partial(export, output=output,