[issue45591] PathFinder does not find namespace packages children

2021-10-27 Thread Filipe Laíns
Filipe Laíns added the comment: Okay, I think that makes sense to me. Thank you!! -- ___ Python tracker ___ ___ Python-bugs-list

[issue45591] PathFinder does not find namespace packages children

2021-10-27 Thread Brett Cannon
Brett Cannon added the comment: The full name argument approach comes from PEP 302. But you want the full name as you are otherwise missing potentially key information for the finder. For instance, if you manipulate __path__, then it's just some random directory you're searching in. But

[issue45591] PathFinder does not find namespace packages children

2021-10-26 Thread Filipe Laíns
Filipe Laíns added the comment: Thank you for clarifying, that does work. This is surprising behavior to me, do you recall what was the reasoning for this design? Or is there some discussion you can point me to? And sorry for bothering, I know I am asking too many questions, but I'd like to

[issue45591] PathFinder does not find namespace packages children

2021-10-26 Thread Brett Cannon
Brett Cannon added the comment: > I am curious, what is `fullname` supposed to mean then? "full" in what sense? You can still specify the full name of the module you're trying to import, but you also need to pass in the location information for that module. So the code does

[issue45591] PathFinder does not find namespace packages children

2021-10-25 Thread Filipe Laíns
Filipe Laíns added the comment: Ah, this was not obvious to me! I did not specify a path, but as it defaults to `sys.path` and `namespace.a` is available there, I was expecting it to find it. One of the things that threw me off was the first arguments being called `fullname`, which I assumed

[issue45591] PathFinder does not find namespace packages children

2021-10-25 Thread Brett Cannon
Brett Cannon added the comment: You didn't specify the path to search in to find `a`. https://docs.python.org/3/library/importlib.html#importlib.machinery.PathFinder.find_spec says that PathFinder only has class methods, which means find_spec() won't know where 'namespace' is, so the search

[issue45591] PathFinder does not find namespace packages children

2021-10-23 Thread Filipe Laíns
New submission from Filipe Laíns : ``` $ tree namespace namespace/ └── a.py 0 directories, 1 file ``` ``` $ ./python Python 3.9.7 (default, Oct 10 2021, 15:13:22) [GCC 11.1.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from importlib.machinery import