Problem: Python search path - module order

aznach aznach at gmail.com
Mon Oct 16 19:04:53 CEST 2006


Hello!

I have a shared hosting account at GrokThis.net and have a problem with
the module order of the Python search path.

I'd like to use django's svn trunk instead of the
"Django-0.95-py2.4.egg" provided in site-packages.

The problem is that the "django egg" gets preference over the "django
svn trunk" module I manually added to PYTHONPATH...

Instead of being prepended to the top of sys.path, the "django svn
trunk" module gets inserted AFTER the eggs that are in
"/usr/lib/python2.4/site-packages".

I use ~/.bash_profile to set:
----------------------------------------------------------------
export PYTHONPATH="$HOME/local/lib/python:$HOME/django_src"
----------------------------------------------------------------

where "django_src" is the location of django's svn trunk directory

sys.path contains:

----------------------------------------------------------------
/usr/lib/python2.4/site-packages/flup-0.5-py2.4.egg
/usr/lib/python2.4/site-packages/setuptools-0.6c1-py2.4.egg
/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg
/usr/lib/python2.4/site-packages/Myghty-1.0.2-py2.4.egg
/usr/lib/python2.4/site-packages/PasteScript-0.9.7-py2.4.egg
/usr/lib/python2.4/site-packages/PasteDeploy-0.9.6-py2.4.egg
/usr/lib/python2.4/site-packages/Paste-0.9.7-py2.4.egg
/usr/lib/python2.4/site-packages/Routes-1.4-py2.4.egg
/usr/lib/python2.4/site-packages/Cheetah-1.0-py2.4-linux-x86_64.egg
/home/shared/username/local/lib/python
/home/shared/username/django_src
/usr/lib/python24.zip
/usr/lib/python2.4
/usr/lib/python2.4/plat-linux2
/usr/lib/python2.4/lib-tk
/usr/lib/python2.4/lib-dynload
/usr/local/lib/python2.4/site-packages
/usr/lib/python2.4/site-packages
/usr/lib/python2.4/site-packages/PIL
----------------------------------------------------------------


importing django form the Python console renders:
----------------------------------------------------------------
>>> import django
>>> django.VERSION
(0, 95, 'post-magic-removal')
>>>
----------------------------------------------------------------

Is there a way to give the "django svn trunk" module preference over
the "django egg" (i.e. to have the "django svn trunk" inserted BEFORE
the eggs listed)??

Does anyone know a solution to this problem? Any help would be greatly
appreciated!

Best regards,
Aznach




More information about the Python-list mailing list