mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-02 11:54:43 +00:00
Fix deprecation warning for use of the imp module
This commit is contained in:
parent
a977e4d712
commit
658c8051f0
1 changed files with 5 additions and 2 deletions
|
|
@ -10,7 +10,7 @@ import os
|
|||
import sys
|
||||
import zipfile
|
||||
import importlib
|
||||
import imp
|
||||
|
||||
from .fileutil import is_writable_by_others
|
||||
|
||||
|
||||
|
|
@ -67,7 +67,10 @@ def get_folder_modules(folder, parentpackage):
|
|||
fullname = os.path.join(folder, filename)
|
||||
modname = parentpackage + "." + filename[:-3]
|
||||
try:
|
||||
yield imp.load_source(modname, fullname)
|
||||
spec = importlib.util.spec_from_file_location(modname, fullname)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
yield module
|
||||
except ImportError as msg:
|
||||
print("WARN: could not load file %s: %s" % (fullname, msg))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue