[Python-ideas] [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

Chris Angelico rosuav at gmail.com
Sun Nov 1 04:02:23 EST 2015


On Sun, Nov 1, 2015 at 7:08 PM, Laura Creighton <lac at openend.se> wrote:
> In a message of Sun, 01 Nov 2015 18:58:36 +1100, Chris Angelico writes:
>>sys.path = ['/usr/local/lib/python36.zip', '/usr/local/lib/python3.6',
>>'/usr/local/lib/python3.6/plat-linux',
>>'/usr/local/lib/python3.6/lib-dynload', '',
>>'/home/rosuav/.local/lib/python3.6/site-packages',
>>'/usr/local/lib/python3.6/site-packages']
>>
>>Equivalently, for the system Python:
>>
>>sys.path = ['/usr/lib/python3.4',
>>'/usr/lib/python3.4/plat-x86_64-linux-gnu',
>>'/usr/lib/python3.4/lib-dynload', '',
>>'/usr/local/lib/python3.4/dist-packages',
>>'/usr/lib/python3/dist-packages']
>>
>>
>>So the current directory is after everything that's logically the
>>standard library, but before things that would be installed separately
>>(site-packages, dist-packages, etc). It'd no longer be possible to
>>shadow wave.py, but you could shadow sqlalchemy.py.
>>
>>ChrisA
>
> But the kid who just wrote string.py or turtle.py will still have
> the 'why isn't this working at all?' experience instead of something
> that warns her what her problem is.

Right. The warning when you save a file of that name is still a useful
thing; it's orthogonal to this, though. (FWIW I think the warning's a
good idea, but it's no panacea.)

ChrisA


More information about the Python-ideas mailing list