Skip to content

AssertionError when parsing musicXML #5

@johentsch

Description

@johentsch

I've tried to extract annotations from the attached musicXML minimal example which I have created and exported in MuseScore2 (changed file extension for upload: test2.txt ).

There were two trials where I got a "Badly formed annotation", namely when using spaces instead of ~ and when the last entry in a label ends with a comma. If I want to annotate a lot, I (personally) don't want to use ~ instead of spaces.

EDIT: I suggest this regex to be used with findall/extractall:
(?P<depth>\d+): ?(?P<label>.+?)(, |,|$)

When the annotations weren't badly formed any more, I got this with every single trial:

python ~/Taking-Form/markup/xml2brackets.py test2.musicxml test2.csv
Traceback (most recent call last):
  File "~/Taking-Form/markup/xml2brackets.py", line 24, in <module>
    main(parser, renderer, inputFile, outputFile)
  File "~/Taking-Form/markup/main.py", line 30, in main
    tree.build(parser.getAnnotations(), parser.getScoreEnd()[0])
  File "~/Taking-Form/markup/Tree.py", line 131, in build
    self.root.addChild(annotation)
  File "~/Taking-Form/markup/Tree.py", line 42, in addChild
    self.children = [Node(Annotation(str(self.getDepth()+1)+": INSERTED LABEL", self.getMeasure(), self.getBeat()))]
  File "~/Taking-Form/markup/Tree.py", line 99, in getBeat
    assert(False)
AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions