"Edit with IDLE" doesn't work any more ?

eryk sun eryksun at gmail.com
Fri Apr 28 09:01:17 EDT 2017

On Fri, Apr 28, 2017 at 12:32 PM, Yip, Kin <kinyip at bnl.gov> wrote:
> Traceback (most recent call last):
>   File "c:\Program Files\Python36\lib\idlelib\pyshell.py", line 4, in <module>
>     from tkinter import *
>   File "C:\Users\kinyip\Desktop\Python Codes\tkinter.py", line 1, in <module>
>     from turtle import *
>   File "c:\Program Files\Python36\lib\turtle.py", line 116, in <module>
>     from tkinter import simpledialog
> ImportError: cannot import name 'simpledialog'

The traceback tells you what you need to know. See how importing
tkinter used your "Python Codes\tkinter.py".

The first part of this problem is that "Edit with IDLE" is executed as
`pythonw.exe -m idlelib "%L" %*`. The -m command-line option adds the
working directory (not the script directory) to the head of sys.path.
The second part is that Explorer starts the process with the working
directory set to the parent directory of the "%L" target file. The 3rd
part is that you have a file in that directory named tkinter.py.
Overall this is a bad experience for beginners, and I know Terry Reedy
is working to improve this.

More information about the Python-list mailing list