[gedit-plugins/wip/python3] Use importlib to import module



commit 8cb3070806e928e5155a0066a2244e9bf0657df4
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Fri Nov 9 11:10:40 2012 +0100

    Use importlib to import module

 plugins/commander/commander/commands/module.py |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/plugins/commander/commander/commands/module.py b/plugins/commander/commander/commands/module.py
index 63f7f43..11be1d3 100644
--- a/plugins/commander/commander/commands/module.py
+++ b/plugins/commander/commander/commands/module.py
@@ -19,10 +19,7 @@
 #  Foundation, Inc., 51 Franklin Street, Fifth Floor,
 #  Boston, MA 02110-1301, USA.
 
-import sys
-import os
-import types
-import bisect
+import sys, os, types, bisect, importlib
 
 import utils
 import commands.exceptions as exceptions
@@ -128,8 +125,8 @@ class Module(method.Method):
             sys.path.insert(0, self._dirname)
 
             self._rollback.monitor()
-            self.mod = __import__(self.real_name, globals(), locals(), [], 0)
             self._rollback.cancel()
+            self.mod = importlib.import_module(self.real_name)
 
             if not utils.is_commander_module(self.mod):
                 raise Exception('Module is not a commander module...')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]