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

Serhiy Storchaka storchaka at gmail.com
Sat Oct 31 02:07:48 EDT 2015


On 30.10.15 09:57, Nathaniel Smith wrote:
> Unfortunately I think that (among other things) there are a lot of
> scripts out there that blindly do sys.path.pop(0) to remove the ""
> entry, so the backcompat costs of changing this would probably be
> catastrophic.

You are right. There are too much occurrences even in public libraries.

https://code.openhub.net/search?s=%22sys.path.pop(0)%22&p=0

Possible workaround is to add fake path (or a duplicate of system path) 
at the start of sys.path. Then dropping first element will not break the 
script.




More information about the Python-Dev mailing list