mirror of
https://github.com/p2p-ld/nwb-linkml.git
synced 2024-11-12 17:54:29 +00:00
return None when the module actually doesn't exist
This commit is contained in:
parent
5438b2489b
commit
d46e86c676
1 changed files with 5 additions and 1 deletions
|
@ -801,12 +801,16 @@ class EctopicModelFinder(MetaPathFinder):
|
|||
# get submodule beneath model stem
|
||||
submod = fullname.replace(self.MODEL_STEM, '').lstrip('.')
|
||||
base_path = Path(self.path, *submod.split('.'))
|
||||
|
||||
# switch if we're asked for a package or a module
|
||||
mod_path = Path(str(base_path) + '.py')
|
||||
pkg_path = base_path / '__init__.py'
|
||||
if mod_path.exists():
|
||||
import_path = mod_path
|
||||
elif pkg_path.exists():
|
||||
import_path = pkg_path
|
||||
else:
|
||||
import_path = base_path / '__init__.py'
|
||||
return None
|
||||
|
||||
spec = importlib.util.spec_from_file_location(fullname, import_path)
|
||||
return spec
|
||||
|
|
Loading…
Reference in a new issue