From 614a96a3d7cdbb2c12b75ec92e3e80493c95e397 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 17 Feb 2015 13:07:09 -0700 Subject: [PATCH] tools/file_import: use python 3.4 importlib API --- artiq/tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/artiq/tools.py b/artiq/tools.py index cc29c0039..7b313d2a9 100644 --- a/artiq/tools.py +++ b/artiq/tools.py @@ -1,4 +1,5 @@ from operator import itemgetter +import sys import importlib.machinery import linecache import logging @@ -27,7 +28,9 @@ def file_import(filename): modname = "file_import_" + modname loader = importlib.machinery.SourceFileLoader(modname, filename) - return loader.load_module() + module = type(sys)(modname) + loader.exec_module(module) + return module def verbosity_args(parser):