diff options
Diffstat (limited to 'io_curve_svg/import_svg.py')
-rw-r--r-- | io_curve_svg/import_svg.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index d68c1113..146f1e01 100644 --- a/io_curve_svg/import_svg.py +++ b/io_curve_svg/import_svg.py @@ -1814,6 +1814,15 @@ def load_svg(filepath): def load(operator, context, filepath=""): - load_svg(filepath) + # error in code should raise exceptions but loading + # non SVG files can give useful messages. + try: + load_svg(filepath) + except (xml.parsers.expat.ExpatError, UnicodeEncodeError) as e: + import traceback + traceback.print_exc() + + operator.report({'WARNING'}, "Unable to parse XML, %s:%s for file %r" % (type(e).__name__, e, filepath)) + return {'CANCELLED'} return {'FINISHED'} |