Terry J. Reedy added the comment:

Steve is correct.  lib/code.py is used for IDLE's Shell.

One should generally avoid naming files the same as stdlib files.  To do so, 
one can either look in the module index of the docs or try 'import somename'.

When Python starts, it imports the modules it uses *before* it adds '' or 
<userdir> to the front of sys.path.  Applications that both import modules and 
run user code need to at least temporarily remove the addition to do imports.  
Having IDLE fix sys.path is #25488.

Duplicate names can also sabotage user code.  More than one person has written, 
for instance, a random.py, forgotten about it, and later written a mystuff.py 
in the same directory.  If mystuff has 'import random' with the intent to use 
the stdlib module, mystuff usually fails, often mysteriously.

When IDLE fails, make sure you run it from a console with 'python -m idlelib' 
(python3 on some systems, idlelib.idle on 2.7).  There will usually be an error 
message, which may or may not help.

----------
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE: Remove '', user_dir, and idlelib from sys.path when added

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29395>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to