On Sat, Aug 22, 2020, at 03:09, Random832 wrote:
> > AttributeError: partially initialized module 'spam' has no attribute 
> > 'egsg' (most likely due to a circular import)
> > 
> > If the error wasn't due to shadowing or a circular import, then knowing 
> > that I had misspelled 'eggs' would be very useful.
> 
> hmm
> 
> what about
> 
> AttributeError: module 'spam' from './spam.py' has no attribute 

I prematurely hit send, I don't mean to suggest remove the attribute name, just 
to add the module path [maybe the full path, whatever's in __file__ would be 
easiest]. This way wouldn't even require detecting circular imports or 
shadowing specifically, though it would require a little bit more alertness on 
the part of the user to notice that the path is not the system module they 
expect.

this could be done in combination with a warning or additional text detecting 
shadowing as suggested in my previous post.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/UJKDGAJIIMNJYS2NYUNJ2XCAEFFLUTUC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to