diff --git a/lnst/Agent/Agent.py b/lnst/Agent/Agent.py index d8b33db82..e2c3fa395 100644 --- a/lnst/Agent/Agent.py +++ b/lnst/Agent/Agent.py @@ -11,6 +11,7 @@ jpirko@redhat.com (Jiri Pirko) """ +import importlib.machinery import signal import logging import os, stat @@ -19,7 +20,6 @@ import socket import ctypes import multiprocessing -import imp import types from time import sleep from inspect import isclass @@ -161,7 +161,8 @@ def load_cached_module(self, module_name, res_hash): if module_name in self._dynamic_modules: return module_path = self._cache.get_path(res_hash) - module = imp.load_source(module_name, module_path) + module_loader = importlib.machinery.SourceFileLoader(module_name, module_path) + module = module_loader.load_module() self._dynamic_modules[module_name] = module def init_cls(self, cls_name, module_name, args, kwargs):