Replace deprecated imp by importlib
This commit is contained in:
parent
30663f2113
commit
47f392ef70
@ -372,13 +372,9 @@ class BasePluginManager:
|
||||
Reloads modules that might not be in the path.
|
||||
"""
|
||||
try:
|
||||
import imp
|
||||
fp, pathname, description = imp.find_module(pdata.mod_name, [pdata.fpath])
|
||||
try:
|
||||
module = imp.load_module(pdata.mod_name, fp, pathname,description)
|
||||
finally:
|
||||
if fp:
|
||||
fp.close()
|
||||
spec = importlib.util.find_spec(pdata.mod_name, [pdata.fpath])
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
except:
|
||||
if pdata.mod_name in sys.modules:
|
||||
del sys.modules[pdata.mod_name]
|
||||
|
@ -47,8 +47,8 @@ from gramps.gen.utils.libformatting import ImportInfo
|
||||
# a quick turnround, without having to restart Gramps.
|
||||
module = __import__("gramps.plugins.lib.libgedcom",
|
||||
fromlist=["gramps.plugins.lib"]) # why o why ?? as above!
|
||||
import imp
|
||||
imp.reload(module)
|
||||
import importlib
|
||||
importlib.reload(module)
|
||||
|
||||
from gramps.gen.config import config
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user