Skip to content

Commit

Permalink
Stop using imp module it's deprecated since python 3.4 and removed in…
Browse files Browse the repository at this point in the history
… python 3.12

Signed-off-by: Evan Blaudy <[email protected]>
  • Loading branch information
EvanBldy committed Oct 9, 2023
1 parent e4e2150 commit 8a43377
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/py-opentimelineio/opentimelineio/plugins/python_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import inspect
import collections
import copy
import importlib.util
import importlib

from .. import (
core,
Expand Down Expand Up @@ -107,18 +107,8 @@ def module_abs_path(self):
def _imported_module(self, namespace):
"""Load the module this plugin points at."""

pyname = os.path.splitext(os.path.basename(self.module_abs_path()))[0]
pydir = os.path.dirname(self.module_abs_path())
return importlib.import_module(f"opentimelineio.{namespace}.{self.name}")

spec = importlib.util.spec_from_file_location(
f"opentimelineio.{namespace}.{self.name}",
os.path.join(pydir, f"{pyname}.py"),
)

mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)

return mod

def module(self):
"""Return the module object for this adapter. """
Expand Down

0 comments on commit 8a43377

Please sign in to comment.