From f651ba457b9cb6afacd295fcffecdd9d79ab9d65 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Fri, 18 Jan 2013 20:14:22 +0000 Subject: make rtfparse import optional --- (limited to 'TurtleArt') diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index c1456d7..19150b3 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -38,7 +38,11 @@ from tapalette import block_names, value_blocks from tautils import get_pixbuf_from_journal, convert, data_from_file, \ text_media_type, round_int, debug_output, find_group -from util.RtfParser import RtfTextOnly +try: + from util.RtfParser import RtfTextOnly + RTFPARSE = True +except ImportError: + RTFPARSE = False from gettext import gettext as _ @@ -761,8 +765,9 @@ class LogoCode: return text = None if text_media_type(self.filepath): - if mimetype == 'application/rtf' or \ - self.filepath.endswith(('rtf')): + if RTFPARSE and ( + mimetype == 'application/rtf' or \ + self.filepath.endswith(('rtf'))): text_only = RtfTextOnly() for line in open(self.filepath, 'r'): text_only.feed(line) -- cgit v0.9.1