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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-01-08 07:49:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-08 07:49:33 +0300
commitc2d133a9fc33da146206f57df2e9dbe2b141114d (patch)
treee4ee9d71ff8258080630a092f20601f72c6b169f /release
parent053776bf577b6554ccb2c63253f6c0bfd99d5de0 (diff)
fix for drawing addons when one of them had a syntax error or would not draw any.
now print the error and continue.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/ui/space_userpref.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index 47b6f3e3cd6..b6f75275229 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -890,14 +890,23 @@ class USERPREF_PT_addons(bpy.types.Panel):
file_mod.close()
- ast_data = ast.parse(data, filename=mod_path)
+ try:
+ ast_data = ast.parse(data, filename=mod_path)
+ except:
+ print("Syntax error 'ast.parse' can't read %r" % mod_path)
+ import traceback
+ traceback.print_exc()
+ ast_data = None
+
body_info = None
- for body in ast_data.body:
- if body.__class__ == ast.Assign:
- if len(body.targets) == 1:
- if getattr(body.targets[0], "id", "") == "bl_addon_info":
- body_info = body
- break
+
+ if ast_data:
+ for body in ast_data.body:
+ if body.__class__ == ast.Assign:
+ if len(body.targets) == 1:
+ if getattr(body.targets[0], "id", "") == "bl_addon_info":
+ body_info = body
+ break
if body_info:
mod = ModuleType(mod_name)