can only decode strings, not arrays of strings

This commit is contained in:
Martin Diehl 2021-07-30 20:09:47 +02:00
parent e97757bd25
commit 83183408ea
1 changed files with 3 additions and 2 deletions

View File

@ -1311,7 +1311,8 @@ class Result:
loc = f[group+'/'+label]
datasets_in[arg]={'data' :loc[()],
'label':label,
'meta': {k:(v if h5py3 else v.decode()) for k,v in loc.attrs.items()}}
'meta': {k:(v.decode() if not h5py3 and type(v) is bytes else v) \
for k,v in loc.attrs.items()}}
lock.release()
r = func(**datasets_in,**args)
return [group,r]
@ -1379,7 +1380,7 @@ class Result:
now.strftime('%Y-%m-%d %H:%M:%S%z').encode()
for l,v in result['meta'].items():
dataset.attrs[l.lower()]=v if h5py3 else v.encode()
dataset.attrs[l.lower()]=v.encode() if not h5py3 and type(v) is str else v
creator = dataset.attrs['creator'] if h5py3 else \
dataset.attrs['creator'].decode()
dataset.attrs['creator'] = f'damask.Result.{creator} v{damask.version}' if h5py3 else \