summaryrefslogtreecommitdiff
path: root/grc/core/FlowGraph.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/core/FlowGraph.py')
-rw-r--r--grc/core/FlowGraph.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py
index 39f998d2aa..138ae44ee5 100644
--- a/grc/core/FlowGraph.py
+++ b/grc/core/FlowGraph.py
@@ -18,7 +18,6 @@
from __future__ import absolute_import, print_function
import collections
-import imp
import itertools
import sys
from operator import methodcaller, attrgetter
@@ -30,6 +29,16 @@ from .utils import expr_utils
from .utils.backports import shlex
+if sys.version_info[0] < 3:
+ import imp
+ def _new_module_helper(name):
+ return imp.new_module(name)
+else:
+ import types
+ def _new_module_helper(name):
+ return types.ModuleType(name)
+
+
class FlowGraph(Element):
is_flow_graph = True
@@ -192,7 +201,7 @@ class FlowGraph(Element):
for id, expr in self.get_python_modules():
try:
- module = imp.new_module(id)
+ module = _new_module_helper(id)
exec(expr, module.__dict__)
namespace[id] = module
except: