Skip to content

Commit

Permalink
[NWBIO] better handling of dict-valued annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Aug 31, 2020
1 parent bbcda25 commit e4d36b3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion neo/io/nwbio.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,14 @@ def write_all_blocks(self, blocks, **kwargs):
else:
for block in blocks:
if annotation_name in block.annotations:
annotations[annotation_name].add(block.annotations[annotation_name])
try:
annotations[annotation_name].add(block.annotations[annotation_name])
except TypeError:
if annotation_name in POSSIBLE_JSON_FIELDS:
encoded = json.dumps(block.annotations[annotation_name])
annotations[annotation_name].add(encoded)
else:
raise
if annotation_name in annotations:
if len(annotations[annotation_name]) > 1:
raise NotImplementedError(
Expand Down

0 comments on commit e4d36b3

Please sign in to comment.