fix for drawing addons when one of them had a syntax error or would not draw any.

now print the error and continue.
This commit is contained in:
Campbell Barton
2011-01-08 04:49:33 +00:00
parent 053776bf57
commit c2d133a9fc

View File

@@ -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)