From 1e64340563a100beaa8dc059000ad6e62b3f3e3a Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Sat, 18 Aug 2007 16:47:29 +0200 Subject: [PATCH] Don't crash when a score does not have an explicit key or clef set (e.g. Rosegarden produces such files). --- scripts/musicxml2ly.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index ed51d9c..52873ff 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -131,10 +131,14 @@ def musicxml_attributes_to_lily (attrs): 'key': musicxml_key_to_lily } for (k, func) in attr_dispatch.items (): - childs = attrs.get_named_children (k) + children = None + try: + children = attrs.get_named_children (k) + except KeyError: + pass ## ugh: you get clefs spread over staves for piano - if childs: + if children: elts.append (func (attrs)) return elts -- 1.5.2.3