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

Yip, Kin kinyip at bnl.gov
Fri Apr 28 09:25:40 EDT 2017

Hi Erky and Peter,

Thanks for the explanations.   Next time, I'd try to treat the "traceback" more seriously :-)
I've learnt the difference between python.exe and python.exe   and   to be more carefully with my code names :-(


-----Original Message-----
From: eryk sun [mailto:eryksun at gmail.com] 
Sent: Friday, April 28, 2017 9:01 AM
To: python-list at python.org
Cc: Yip, Kin <kinyip at bnl.gov>
Subject: Re: "Edit with IDLE" doesn't work any more ?

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