If a file named "tkinter.py" is created and tkinter is imported and used within 
the file, the following exception is raised:
"AttributeError: partially initialized module 'tkinter' has no attribute 'Tk' 
(most likely due to a circular import)"

I've spoken to multiple beginners who got stuck on this and just couldn't 
figure out what was happening. Just like the error message tells us, it's due 
to a "circular import". In other words, we're trying to import the very file 
that is doing the import. To make the message easier to understand, I propose 
that we change the message to something that mentions that the program is 
trying to import itself.

I think the following would be an option:
"ImportError: partially initialized module 'tkinter' can't import itself"

I can't think of any reason to import itself in a way like this, but even if 
there is a valid reason, the error message could probably be improved. Of 
course, this applies to more than just tkinter.
_______________________________________________
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/XJIEQQ7FCTNVKB7SMRQS2IJSSANRDU26/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to