On 9 February 2010 14:16, louisplp <[email protected]> wrote: > Yes, I use site.addsitedir. But it still loads the paste package of > the system python. > > $ python >>>> import site >>>> site.addsitedir('/home/lemieulp/python_virtualenv/lib/python2.6/site-packages') >>>> import paste >>>> print paste.__path__ > ['/usr/lib/python2.6/site-packages/paste']
That is because site.addsitedir() sticks stuff at the end of sys.path and doesn't reorder the path to put new additions at front and so before anything that may be installed in site wide Python. Have a read of: http://code.google.com/p/modwsgi/wiki/VirtualEnvironments where it talks about reordering and what you need to manually do and/or how to avoid that by using python-path option or WSGIPythonPath directive as appropriate. Can you post more about the mod_wsgi configuration in Apache you are using and what you have in the WSGI script file? Graham > Here is what I have when using the virtualenv I created > > $ ~/python_virtualenv/bin/python >>>> import paste >>>> print paste.__path__ > ['/home/lemieulp/python_virtualenv/lib/python2.6/site-packages/ > PasteScript-1.7.3-py2.6.egg/paste', '/home/lemieulp/python_virtualenv/ > lib/python2.6/site-packages/PasteDeploy-1.3.3-py2.6.egg/paste', '/home/ > lemieulp/python_virtualenv/lib/python2.6/site-packages/Paste-1.7.2- > py2.6.egg/paste'] > > Yes, the .pth file (which is easy-install.pth) contains the required > namespace > > $ cat easy-install.pth > import sys; sys.__plen = len(sys.path) > ./setuptools-0.6c11-py2.6.egg > ./pip-0.6.3-py2.6.egg > ./Pylons-0.9.7-py2.6.egg > ./Tempita-0.4-py2.6.egg > ./WebTest-1.2-py2.6.egg > ./WebError-0.10.1-py2.6.egg > ./WebOb-0.9.8-py2.6.egg > ./Mako-0.2.5-py2.6.egg > ./nose-0.11.1-py2.6.egg > ./decorator-3.1.2-py2.6.egg > ./simplejson-2.0.9-py2.6-linux-i686.egg > ./FormEncode-1.2.2-py2.6.egg > ./PasteScript-1.7.3-py2.6.egg > ./PasteDeploy-1.3.3-py2.6.egg > ./Paste-1.7.2-py2.6.egg > ./Beaker-1.5.1-py2.6.egg > ./WebHelpers-1.0b4-py2.6.egg > ./Routes-1.11-py2.6.egg > ./Pygments-1.2.2-py2.6.egg > ./Sphinx-0.6.4-py2.6.egg > ./docutils-0.6-py2.6.egg > ./Jinja2-2.2.1-py2.6.egg > ./AuthKit-0.4.5-py2.6.egg > ./elementtree-1.2.7_20070827_preview-py2.6.egg > ./python_openid-2.2.4-py2.6.egg > import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; > p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p > +len(new) > > > On 8 fév, 22:03, Ian Bicking <[email protected]> wrote: >> On Mon, Feb 8, 2010 at 8:43 PM, Graham Dumpleton <[email protected] >> >> > wrote: >> > python >> > >>> import paste >> > >>> print paste.__file__ >> >> > That will give you location. >> >> It gets more complicated; since paste is a namespace package then >> paste.__path__ may contain other paths that will be searched, e.g., >> site-packages/Paste-X.Y.egg/paste and >> site-packages/PasteDeploy-X.Y.egg/paste -- or, if it's not working, maybe >> those values won't be right. >> >> Though of course it should work properly, you might try pip which installs >> namespace packages flat, and might at least avoid the problem you are >> having. >> >> Also if you aren't using site.addsitedir, you might not get the path setup >> properly; there's a .pth file which I believe makes sure easy_install'd >> namespace packages work. >> >> -- >> Ian Bicking | http://blog.ianbicking.org | http://twitter.com/ianbicking > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
