You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MusicXML export fails on "check_simultan self.sections.pop()" #76
Export to MusicXML fails with the following error:
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/frescobaldi_app/file_export/__init__.py", line 65, in exportMusicXML
writer.parse_text(doc.toPlainText())
File "/usr/lib64/python2.7/site-packages/ly/musicxml/lymus2musxml.py", line 102, in parse_text
self.parse_document(doc)
File "/usr/lib64/python2.7/site-packages/ly/musicxml/lymus2musxml.py", line 119, in parse_document
self.parse_tree(mustree)
File "/usr/lib64/python2.7/site-packages/ly/musicxml/lymus2musxml.py", line 133, in parse_tree
self.parse_nodes(mus_nodes)
File "/usr/lib64/python2.7/site-packages/ly/musicxml/lymus2musxml.py", line 145, in parse_nodes
func_call(m)
File "/usr/lib64/python2.7/site-packages/ly/musicxml/lymus2musxml.py", line 624, in End
self.mediator.check_simultan()
File "/usr/lib64/python2.7/site-packages/ly/musicxml/ly2xml_mediator.py", line 293, in check_simultan
self.sections.pop()
IndexError: pop from empty list
(the \includes in that file are all layout/font options. The entire file tree can be found here).
What is going wrong here? Is there some issue of formatting that isn't being correctly interpreted?
Note that this file can only be compiled in the original context as otherwise the includes cannot be resolved.
I suspected this failed include could be the reason but when placing the flattened file in the original context a) it became compilable and b) the MusicXML export fails with the same message. So this is not the issue.
The other thing is that I tried that with python-ly from Git (where the OP obviously has the packaged version), and the error is the same. So that isn't a reason either.
I bumped into this bug when trying a very simple test:
create a very simple minimal.ly test with for example only { c' d' e' f' }
ly musicxml minimal.ly -o minimal.musicxml
musicxml2ly minimal.musicxml -o minimal2.ly
ly musicxml minimal2.ly -o minimal2.musicxml
Unknown command: \mergeDifferentlyDottedOn
Unknown command: \mergeDifferentlyHeadedOn
Warning: End not implemented!
'NoneType' object has no attribute 'merge_voice'
Traceback (most recent call last):
File "/usr/bin/ly", line 4, in
sys.exit(main())
File "/usr/lib/python3.7/site-packages/ly/cli/main.py", line 288, in main
c.run(options, cursor, output)
File "/usr/lib/python3.7/site-packages/ly/cli/command.py", line 221, in run
writer.parse_document(cursor.document, absolute)
File "/usr/lib/python3.7/site-packages/ly/musicxml/lymus2musxml.py", line 119, in parse_document
self.parse_tree(mustree)
File "/usr/lib/python3.7/site-packages/ly/musicxml/lymus2musxml.py", line 133, in parse_tree
self.parse_nodes(mus_nodes)
File "/usr/lib/python3.7/site-packages/ly/musicxml/lymus2musxml.py", line 145, in parse_nodes
func_call(m)
File "/usr/lib/python3.7/site-packages/ly/musicxml/lymus2musxml.py", line 624, in End
self.mediator.check_simultan()
File "/usr/lib/python3.7/site-packages/ly/musicxml/ly2xml_mediator.py", line 293, in check_simultan
self.sections.pop()
IndexError: pop from empty list
As a workaround I changed line 293 in ly2xml_mediator.py. I am not enough of a Python programmer to judge if this makes any sense, but it worked for me now.
# self.sections.pop()
if self.sections:
self.sections.pop()
The same situation in 2022. As written in previous comment it's possible to patch /usr/lib/python3/dist-packages/ly/musicxml/ly2xml_mediator.py — different lines but the same code
301c301,302< self.sections.pop()---> if self.sections:> self.sections.pop()
@fedelibre Testing that self.sections isn't empty before pop()-ing it is basic defensive programming. It should be in there regardless of whether there's another underlying bug. I just merged #184 which should hopefully fix this.
Activity
uliska commentedon Oct 23, 2016
Note that this file can only be compiled in the original context as otherwise the includes cannot be resolved.
I suspected this failed include could be the reason but when placing the flattened file in the original context a) it became compilable and b) the MusicXML export fails with the same message. So this is not the issue.
The other thing is that I tried that with
python-lyfrom Git (where the OP obviously has the packaged version), and the error is the same. So that isn't a reason either.mtarenskeen commentedon Nov 6, 2019
I bumped into this bug when trying a very simple test:
Unknown command: \mergeDifferentlyDottedOn
Unknown command: \mergeDifferentlyHeadedOn
Warning: End not implemented!
'NoneType' object has no attribute 'merge_voice'
Traceback (most recent call last):
File "/usr/bin/ly", line 4, in
sys.exit(main())
File "/usr/lib/python3.7/site-packages/ly/cli/main.py", line 288, in main
c.run(options, cursor, output)
File "/usr/lib/python3.7/site-packages/ly/cli/command.py", line 221, in run
writer.parse_document(cursor.document, absolute)
File "/usr/lib/python3.7/site-packages/ly/musicxml/lymus2musxml.py", line 119, in parse_document
self.parse_tree(mustree)
File "/usr/lib/python3.7/site-packages/ly/musicxml/lymus2musxml.py", line 133, in parse_tree
self.parse_nodes(mus_nodes)
File "/usr/lib/python3.7/site-packages/ly/musicxml/lymus2musxml.py", line 145, in parse_nodes
func_call(m)
File "/usr/lib/python3.7/site-packages/ly/musicxml/lymus2musxml.py", line 624, in End
self.mediator.check_simultan()
File "/usr/lib/python3.7/site-packages/ly/musicxml/ly2xml_mediator.py", line 293, in check_simultan
self.sections.pop()
IndexError: pop from empty list
mtarenskeen commentedon Nov 6, 2019
As a workaround I changed line 293 in ly2xml_mediator.py. I am not enough of a Python programmer to judge if this makes any sense, but it worked for me now.
shoorick commentedon Apr 23, 2022
The same situation in 2022. As written in previous comment it's possible to patch
/usr/lib/python3/dist-packages/ly/musicxml/ly2xml_mediator.py— different lines but the same codefedelibre commentedon Feb 6, 2026
It's probably a workaround to avoid the error, but not the best solution to fix the underlying bug. I'm not able to help.
bmjcode commentedon Feb 7, 2026
@fedelibre Testing that
self.sectionsisn't empty beforepop()-ing it is basic defensive programming. It should be in there regardless of whether there's another underlying bug. I just merged #184 which should hopefully fix this.fedelibre commentedon Apr 1, 2026
Fixed by #184