Skip to content

Commit a87cf25

Browse files
committed
fix(annotations): decode byte string to utf-8
1 parent ac7ddf5 commit a87cf25

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

pyneuroml/annotations.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -396,21 +396,15 @@ def create_annotation(
396396
# https://github.com/LEMS/jLEMS/issues/127
397397
annotation_etree = etree.fromstring(annotation)
398398

399-
annotation_str = str(
399+
annotation_str = (
400400
etree.tostring(
401-
annotation_etree,
402-
pretty_print=True,
403-
xml_declaration=xml_header,
401+
annotation_etree, pretty_print=True, xml_declaration=xml_header
404402
)
405-
)
403+
).decode("utf-8")
406404

407405
if write_to_file:
408406
with open(write_to_file, "w") as f:
409-
annotation_etree.write(
410-
f,
411-
xml_declaration=xml_header,
412-
pretty_print=True,
413-
)
407+
print(annotation_str, file=f)
414408

415409
# indent
416410
if indent > 0:
@@ -614,6 +608,9 @@ def extract_annotations(
614608
obj_id = parent.attrib["id"]
615609
except KeyError:
616610
obj_id = ""
611+
612+
print(a)
613+
617614
annotations[obj_id] = self.parse_rdf(a)
618615

619616
logger.info("Annotations in %s: " % (nml2_file))

0 commit comments

Comments
 (0)