From 503b1eec87f558ef35120899421c5fb25a09ed6b Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 9 Jan 2007 14:36:03 +0100 Subject: [PATCH] don't crash on unknown musicxml drums. --- scripts/musicxml2ly.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index 431a43631c..665cc1d02f 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -208,8 +208,11 @@ def musicxml_note_to_lily_main_event (n): event = musicexp.RestEvent() elif n.instrument_name: event = musicexp.NoteEvent () - event.drum_type = instrument_drumtype_dict[n.instrument_name] - + try: + event.drum_type = instrument_drumtype_dict[n.instrument_name] + except KeyError: + n.message ("drum %s type unknow, please add to instrument_drumtype_dict" % n.instrument_name) + event.drum_type = 'acousticsnare' if not event: n.message ("cannot find suitable event") -- 2.39.5