Closed din14970 closed 3 years ago
Actually went in to check which value is giving the issue, it seems to be some odd part of the original metadata
Writing attribute: Original-Operations-DisplayLevelsOperation-01661259da254a7190c741cfe208c723-outputs with value: [{'outputIndex': '0', 'operation': '/Presentation/Displays/ImageDisplay/2952d1eacfec4233a75934295d8d495c', 'inputIndex': '0'}]
for now I've solved it with:
try:
h5_obj.attrs[key] = clean_val
except Exception:
h5_obj.attrs[key] = str(clean_val)
But I guess that goes a bit against the philosophy of the way metadata should be stored.
@din14970 - Thank you for bringing this to our attention. I have implemented more safeguards against such situations. See this commit.
Anyone interested in improving testing for write_simple_attrs
is welcome.
Thanks! I guess it's good to have safeguards in here as you implemented. A full fix for my case will probably require a look at how the hyperspy original metadata is mapped to tags in USID; I would guess it's a JSON flattening issue there. Will see whether I can find a solution there.
I'm trying to write out a hyperspy signal to USID, which uses sidpy under the hood. The signal was loaded from an experimental Velox EMD file. The full exception stack: