From 5b4bdcf4e6c7c823eeda0432e37d76277768b588 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Wed, 19 Sep 2007 03:29:56 +0200 Subject: [PATCH] MusicXML: Fixes of my previous commit If a score does not use any elements, fool musicxml2ly with a dummy value of "None". Similarly, don't use dict[staff], but dict.get to avoid crashes in that case. Signed-off-by: Reinhold Kainhofer --- python/musicxml.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/musicxml.py b/python/musicxml.py index 7281a129f3..e9660eb571 100644 --- a/python/musicxml.py +++ b/python/musicxml.py @@ -549,6 +549,8 @@ class Part (Music_xml_node): sid = None if staff_id: sid = staff_id.get_text () + else: + sid = "None" if vid and not voices.has_key (vid): voices[vid] = Musicxml_voice() if vid and sid and not n.get_maybe_exist_typed_child (Grace): @@ -592,7 +594,7 @@ class Part (Music_xml_node): if staff_id: staff_id = staff_id.get_text () if staff_id: - dir_voices = staff_to_voice_dict[staff_id] + dir_voices = staff_to_voice_dict.get (staff_id, voices.keys ()) else: dir_voices = voices.keys () for v in dir_voices: -- 2.39.5