Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-04-04 07:01:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-04-04 07:01:06 +0400
commitc4fb4a11423f054f53186ed66a111eff2e70521d (patch)
treef4ae9ade5e88ff1079301938b96a3e4c0b4afd58 /io_curve_svg
parent29ff1ba3598e501a934270673486054fcb53728f (diff)
handle exceptions for reading non XML files - cant decode or parse, real errors in code will still raise exceptions.
Diffstat (limited to 'io_curve_svg')
-rw-r--r--io_curve_svg/import_svg.py11
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'}