Skip to content

Commit

Permalink
Use importlib instead of imp
Browse files Browse the repository at this point in the history
`imp` module is removed in python3.12
  • Loading branch information
Kuba314 authored and olichtne committed Nov 27, 2023
1 parent f7b1fb7 commit a016fa3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lnst/Agent/Agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[email protected] (Jiri Pirko)
"""

import importlib.machinery
import signal
import logging
import os, stat
Expand All @@ -19,7 +20,6 @@
import socket
import ctypes
import multiprocessing
import imp
import types
from time import sleep
from inspect import isclass
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit a016fa3

Please sign in to comment.