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-11-26 21:41:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-26 21:41:56 +0400
commit616bf9bae307c6ede0b9e96ae935259238ef212f (patch)
treeee9cdf19101bde200c4fcfac213d4ec64cb88d75 /release/scripts/modules/addon_utils.py
parent3db309ee50db09616750c6ce1b6ab55846d67931 (diff)
check if an addon exists before getting its mtime
Diffstat (limited to 'release/scripts/modules/addon_utils.py')
-rw-r--r--release/scripts/modules/addon_utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py
index de662b47c4d..21f856a1396 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -235,7 +235,8 @@ def enable(module_name, default_set=True):
# 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 @@ def enable(module_name, default_set=True):
# Split registering up into 3 steps so we can undo
# if it fails par way through.
+
# 1) try import
try:
mod = __import__(module_name)