Skip to content

Commit

Permalink
try/except around write_metadata in case read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
kkappler committed Dec 18, 2023
1 parent c05d933 commit 51ce34e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mth5/groups/fc_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ def __init__(
self.metadata.mth5_type = self._class_name

# write out metadata to make sure that its in the file.
if write_metadata:
try:
self.write_metadata()
except RuntimeError:
# file is read only
pass

# if the attrs don't have the proper metadata keys yet write them
if not "mth5_type" in list(self.hdf5_dataset.attrs.keys()):
self.write_metadata()
Expand Down

0 comments on commit 51ce34e

Please sign in to comment.