[Distutils] eggs end up at end of sys.path

David Handy david at handysoftware.com
Wed Nov 9 03:41:48 CET 2005

On Tue, Nov 08, 2005 at 04:11:31PM -0500, Phillip J. Eby wrote:
> At 03:10 PM 11/8/2005 -0500, David Handy wrote:
> >"""
> >Activated distributions are now inserted in sys.path (and the working set)
> >just before the directory that contains them, instead of at the end. This
> >allows e.g. eggs in site-packages to override unmanaged modules in the same
> >location, and allows eggs found earlier on sys.path to override ones found
> >later.
> >"""
> >
> >However, after I do a pkg_resources.require(), my egg always ends up at the
> >end of sys.path. I exected the egg file to show up before the directory 
> >that
> >contained it, in this case a non-site-packages directory in my PYTHONPATH.
> >This is on setuptools versions 0.6a7 and 0.6a8dev-r41402.
> Could you provide me with your steps to reproduce, so I can try to find out 
> what's wrong?
> One possibly important thing: the code that finds what sys.path entry 
> contains the egg is currently case-sensitive and separator-sensitive.  It's 
> possible that if your PYTHONPATH uses lowercase and slash separators and 
> the egg is the other way around, or vice versa, the container checking may 
> be failing.  You can verify this by printing sys.path after the require() 
> and see if the paths are the same.

I created a fairly minimal project which I have attached as
MyProject-0.1.zip which demonstrates the problem. On Linux, it puts the egg
in the proper place in sys.path (ahead of the PYTHONPATH directory), but on
Windows it puts the egg file on the end. See the README.txt file for
example output. (I have seen this problem on both Win98 and WinXP.)

David Handy
Computer Programming is Fun!
Beginning Computer Programming with Python
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyProject-0.1.zip
Type: application/zip
Size: 5105 bytes
Desc: not available
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20051108/7f955906/MyProject-0.1.zip

More information about the Distutils-SIG mailing list