On Thu, Nov 4, 2021 at 6:37 AM Ethan Furman
On 11/3/21 12:21 PM, Florian Wetschoreck wrote:
In order to prevent confusion, I want to point out that the primary scenario that I meant is not that the file imports itself but another file in the same directory with the name of a module that is also installed in site-packages. Not sure if I made that clear in my original post?
Maybe if the module-level AttributeError included the complete path/filename of the module? It would then be much more easily discernible that the imported "pandas" is not the correct one.
I like this idea. It already happens with a from-import. A cursory look at Objects/moduleobject.c suggests that it'd be one more lookup in the error handling in module_getattro, pretty doable. ChrisA