[Distutils] [issue80] sys.path corruption in pkg_resource.py

raybaut setuptools at bugs.python.org
Wed Jul 15 11:45:52 CEST 2009


New submission from raybaut <pierre.raybaut at gmail.com>:

Tested on Windows XP with setuptools 0.6c9:
1. Open a Python intepreter in "C:\Python25\Lib\site-packages":
    a) run cmd.exe
    b) change directory to "C:\Python25\Lib\site-packages"
    c) run python.exe
2. type "from pkg_resources import resource_stream"
3. type "import sys; sys.path" -> you will see that
"C:\Python25\Lib\site-packages" has been removed from sys.path


The "C:\Python25\Lib\site-packages" sys.path entry is removed abusively by
"C:\Python25\lib\site-packages\pkg_resources.py", at line 2250, in insert_on:
del npath[np], path[np].

The reason is that, in interactive mode, the first entry of sys.path is '' - and
pkg_resources.py replace it by "C:\Python25\Lib\site-packages" at line 2228:
npath= map(_normalize_cached, path)
...and then considers it as a replicate to be removed at line 2250.

----------
messages: 327
nosy: raybaut
priority: bug
status: unread
title: sys.path corruption in pkg_resource.py

_______________________________________________
Setuptools tracker <setuptools at bugs.python.org>
<http://bugs.python.org/setuptools/issue80>
_______________________________________________


More information about the Distutils-SIG mailing list