diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index adb2f585d..73882917b 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -584,7 +584,7 @@ def strip_rtf(text, default_encoding=None): if encoding: out.append(chr(charcode).decode(encoding)) else: - raise Exception(u'user_canceled') + return None except UnicodeDecodeError: failed = True else: diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py index e839a6354..f462b102b 100644 --- a/openlp/plugins/songs/lib/ewimport.py +++ b/openlp/plugins/songs/lib/ewimport.py @@ -180,13 +180,10 @@ class EasyWorshipSongImport(SongImport): self.addAuthor(author_name.strip()) if words: # Format the lyrics - try: - words, self.encoding = strip_rtf(words, self.encoding) - except Exception as info: - if unicode(info) == u'user_canceled': - return - else: - raise + words = strip_rtf(words, self.encoding) + if words is None: + return + words, self.encoding = words verse_type = VerseType.Tags[VerseType.Verse] for verse in SLIDE_BREAK_REGEX.split(words): verse = verse.strip() diff --git a/openlp/plugins/songs/lib/songproimport.py b/openlp/plugins/songs/lib/songproimport.py index ca34a4bd0..928ce85ec 100644 --- a/openlp/plugins/songs/lib/songproimport.py +++ b/openlp/plugins/songs/lib/songproimport.py @@ -109,14 +109,11 @@ class SongProImport(SongImport): self.finish() return if u'rtf1' in text: - try: - text, self.encoding = strip_rtf(text, self.encoding) - text = text.rstrip() - except Exception as info: - if unicode(info) == u'user_canceled': - return - else: - raise + text = strip_rtf(text, self.encoding) + if text is None: + return + text, self.encoding = text + text = text.rstrip() if not text: return if tag == u'A': diff --git a/openlp/plugins/songs/lib/sundayplusimport.py b/openlp/plugins/songs/lib/sundayplusimport.py index 8d7330411..c514d4014 100644 --- a/openlp/plugins/songs/lib/sundayplusimport.py +++ b/openlp/plugins/songs/lib/sundayplusimport.py @@ -150,14 +150,11 @@ class SundayPlusImport(SongImport): verse_type = HOTKEY_TO_VERSE_TYPE[value] if name == 'rtf': value = self.unescape(value) - try: - verse, self.encoding = strip_rtf(value, self.encoding) - lines = verse.strip().split('\n') - except Exception as info: - if unicode(info) == u'user_canceled': - return - else: - raise + verse = strip_rtf(value, self.encoding) + if verse is None: + return + verse, self.encoding = verse + lines = verse.strip().split('\n') # If any line inside any verse contains CCLI or # only Public Domain, we treat this as special data: # we remove that line and add data to specific field.