Feb-07-2020, 10:23 PM
Hi,
I have a question pertaining to importing post python 3.4 (I am using python 3.8). It is my understanding that the import engine will internally invoke meta path finders in sys.meta_path, of which the third PathFinder is used to find modules using sys.path. Given the following file structure, with "test" and "a" being namespace packages,
example/test/a/b.py
If I run an interpreter with cwd as example, the following code fails:
My question is, since the test builtin does not have a module "a", why does the third PathFinder fail to find the module, as the FileFinder with cwd should be able to locate the module?
I have a question pertaining to importing post python 3.4 (I am using python 3.8). It is my understanding that the import engine will internally invoke meta path finders in sys.meta_path, of which the third PathFinder is used to find modules using sys.path. Given the following file structure, with "test" and "a" being namespace packages,
example/test/a/b.py
If I run an interpreter with cwd as example, the following code fails:
>>> import test.a Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'test.a'
My question is, since the test builtin does not have a module "a", why does the third PathFinder fail to find the module, as the FileFinder with cwd should be able to locate the module?