[kupfer] core: Check if module exists before unloading at plugin unload
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer] core: Check if module exists before unloading at plugin unload
- Date: Thu, 3 Mar 2011 01:13:45 +0000 (UTC)
commit 1a4b0a18b700c74a6b24a6f3b9d0f17974035406
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Thu Mar 3 02:11:30 2011 +0100
core: Check if module exists before unloading at plugin unload
kupfer/core/plugins.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/core/plugins.py b/kupfer/core/plugins.py
index 6de86ba..2ec6ff8 100644
--- a/kupfer/core/plugins.py
+++ b/kupfer/core/plugins.py
@@ -379,7 +379,8 @@ def unimport_plugin(plugin_name):
del _imported_plugins[plugin_name]
plugin_module_name = ".".join(_plugin_path(plugin_name))
pretty.print_debug(__name__, "Dereferencing module", plugin_module_name)
- sys.modules.pop(plugin_module_name)
+ if plugin_module_name in sys.modules:
+ sys.modules.pop(plugin_module_name)
for mod in list(sys.modules):
if mod.startswith(plugin_module_name + "."):
pretty.print_debug(__name__, "Dereferencing module", mod)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]