diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-23 04:37:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-23 04:37:58 +0300 |
commit | 3e8c0027a374e963e6e7e66f8a0e475af05b9943 (patch) | |
tree | be756d2300a07fb46edc78c7225c6601dde299f2 /release/scripts/modules | |
parent | 6a6e4a9d47fc70f2744aa499a1fed47c8d0718d2 (diff) |
Cleanup: replace deprecated imp -> importlib
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/addon_utils.py | 8 | ||||
-rw-r--r-- | release/scripts/modules/bpy/utils.py | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index ae9575e7b3e..56681e11c8a 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -267,11 +267,11 @@ def enable(module_name, default_set=True, persistent=False, handle_error=None): mtime_orig = getattr(mod, "__time__", 0) mtime_new = os.path.getmtime(mod.__file__) if mtime_orig != mtime_new: - import imp + import importlib print("module changed on disk:", mod.__file__, "reloading...") try: - imp.reload(mod) + importlib.reload(mod) except: handle_error() del sys.modules[module_name] @@ -384,10 +384,10 @@ def reset_all(reload_scripts=False): # first check if reload is needed before changing state. if reload_scripts: - import imp + import importlib mod = sys.modules.get(mod_name) if mod: - imp.reload(mod) + importlib.reload(mod) if is_enabled == is_loaded: pass diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index b3a7a13e331..dd771aff044 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -185,7 +185,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): traceback.print_exc() def test_reload(mod): - import imp + import importlib # reloading this causes internal errors # because the classes from this module are stored internally # possibly to refresh internal references too but for now, best not to. @@ -193,7 +193,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): return mod try: - return imp.reload(mod) + return importlib.reload(mod) except: import traceback traceback.print_exc() |