mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Check spec.loader is not None when importing a plugin.
This commit is contained in:
parent
0f3264cf26
commit
8f001f8045
@ -69,7 +69,10 @@ def loadPluginModule(name, ignoreDeprecation=False):
|
||||
if hasattr(importlib.util, 'module_from_spec'):
|
||||
# Python >= 3.5
|
||||
spec = importlib.machinery.PathFinder.find_spec(name, pluginDirs)
|
||||
if spec is None:
|
||||
if spec is None or spec.loader is None:
|
||||
# spec is None if 'name' can't be found; and
|
||||
# spec.loader might be None in some rare occasions as well
|
||||
# (eg. for namespace packages)
|
||||
assert ImportError(name)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
sys.modules[module.__name__] = module
|
||||
|
Loading…
Reference in New Issue
Block a user