diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index d68c1113e5acb4ddd13aeb56778dd68605cba7e1..146f1e014c72c9ebcc838bfb0ccceca52e7ec3d0 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'}