Skip to content

Commit

Permalink
update deprecated imp to importlib (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfarrens authored Apr 20, 2021
1 parent e988e53 commit 101b9f3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pysap/base/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import sys
import re
import os
import imp
import importlib


class PluginsMetaImportHook(object):
Expand Down Expand Up @@ -47,7 +47,7 @@ def find_module(self, name, path=None):
# Find the sub module and build the module path
# TODO: use importlib.util.find_spec for Python >= 3.5 only
try:
self.file, self.filename, self.stuff = imp.find_module(
self.file, self.filename, self.stuff = importlib.find_module(
self.sub_name, path)
self.path = [self.filename]
except ImportError:
Expand All @@ -62,7 +62,12 @@ def load_module(self, name):
of the module/package that was requested.
"""
# Load the module
module = imp.load_module(name, self.file, self.filename, self.stuff)
module = importlib.load_module(
name,
self.file,
self.filename,
self.stuff
)
if self.file:
self.file.close()

Expand Down

0 comments on commit 101b9f3

Please sign in to comment.