[Python-Dev] Order that site-packages is added to sys.path (original) (raw)

Greg Ward gward@python.net
Tue, 12 Feb 2002 10:27:24 -0500


On 12 February 2002, Barry A. Warsaw said:

The standalone email package is a simple distutils thingie with a directory and a bunch of .py files. distutils sticks this in site-packages. But an "import email" will always get the standard library version instead of the site-packages version because site.py /appends/ site-packages to sys.path instead of prepending it.

I can work around this by adding my own path-hacking code before any import of email.* modules. This is a bit ugly because now it means that the proper functioning of the application depends on import order, and that's nasty.

Looong ago, I tried to persuade Guido that giving the Distutils the power to override standard library modules would, on rare occasions, be a good and useful thing. (Yet another idea stolen from Perl's MakeMaker, which can do precisely that. Sometimes, it's useful.) Guess who won?

    Greg

-- Greg Ward - just another Python hacker gward@python.net http://starship.python.net/~gward/ A closed mouth gathers no foot.