[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42176] trunk/blender/release/scripts/ modules/addon_utils.py: check if an addon exists before getting its mtime

Campbell Barton ideasman42 at gmail.com
Sat Nov 26 18:42:06 CET 2011


Revision: 42176
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42176
Author:   campbellbarton
Date:     2011-11-26 17:41:56 +0000 (Sat, 26 Nov 2011)
Log Message:
-----------
check if an addon exists before getting its mtime

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/addon_utils.py

Modified: trunk/blender/release/scripts/modules/addon_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/addon_utils.py	2011-11-26 17:22:11 UTC (rev 42175)
+++ trunk/blender/release/scripts/modules/addon_utils.py	2011-11-26 17:41:56 UTC (rev 42176)
@@ -235,7 +235,8 @@
 
     # reload if the mtime changes
     mod = sys.modules.get(module_name)
-    if mod:
+    # chances of the file _not_ existing are low, but it could be removed
+    if mod and os.path.exists(mod.__file__):
         mod.__addon_enabled__ = False
         mtime_orig = getattr(mod, "__time__", 0)
         mtime_new = os.path.getmtime(mod.__file__)
@@ -252,6 +253,7 @@
 
     # Split registering up into 3 steps so we can undo
     # if it fails par way through.
+
     # 1) try import
     try:
         mod = __import__(module_name)




More information about the Bf-blender-cvs mailing list