[Bf-blender-cvs] [e408e63] master: Addons: print short message if an addons missing

Campbell Barton noreply at git.blender.org
Thu Feb 12 13:51:26 CET 2015


Commit: e408e632a110a8cf4537c4fcdb5a47478b6110cd
Author: Campbell Barton
Date:   Thu Feb 12 23:42:51 2015 +1100
Branches: master
https://developer.blender.org/rBe408e632a110a8cf4537c4fcdb5a47478b6110cd

Addons: print short message if an addons missing

Was printing full traceback, harmless but verbose.

===================================================================

M	release/scripts/modules/addon_utils.py

===================================================================

diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py
index d955985..8c86f31 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -306,8 +306,13 @@ def enable(module_name, default_set=False, persistent=False, handle_error=None):
             mod = __import__(module_name)
             mod.__time__ = os.path.getmtime(mod.__file__)
             mod.__addon_enabled__ = False
-        except:
-            handle_error()
+        except Exception as ex:
+            # if the addon doesn't exist, dont print full traceback
+            if type(ex) is ImportError and ex.name == module_name:
+                print("addon not found: %r" % module_name)
+            else:
+                handle_error()
+
             if default_set:
                 _addon_remove(module_name)
             return None




More information about the Bf-blender-cvs mailing list