[issue46806] Overlapping PYTHONPATH may cause import already imported module

Eric Snow report at bugs.python.org
Wed Feb 23 10:42:48 EST 2022


Eric Snow <ericsnowcurrently at gmail.com> added the comment:

FYI, a technical solution has been discussed before: bpo-13475 and PEP 395.  However, that does not help so much if the default behavior isn't changed.  That would require a PEP but I expect it would be rejected because so many scripts already rely on the current behavior and the current behavior is useful in some cases.

PEP 395 also has a good discussion of the various pitfalls related to sys.path[0] initialization.  Furthermore, the topic is discussed in quite a few issues, such as bpo-44132 and bpo-29929.

Probably the best use of your time on this would be to improve the documentation so people will more easily avoid the problem, or at least more easily diagnose the situation when they stumble on it.  Again, PEP 395 is a good guide for this.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46806>
_______________________________________


More information about the Python-bugs-list mailing list