Graham Carlyle
graham.carlyle at maplecroft.net
Fri Sep 14 05:40:23 EDT 2007
Ah, I'm now not sure what was happening before as this morning what I described isn't working. So sorry for the muddle. However after checking what was on sys.path from a modpython handler & also from the shell with the correct PYTHONPATH. The difference was the egg... from modpython handler: Path is ['/opt/apps/simple', '/opt/python/python-2.5.1/lib/python25.zip', '/opt/python/python-2.5.1/lib/python2.5', '/opt/python/python-2.5.1/lib/python2.5/plat-linux2', '/opt/python/python-2.5.1/lib/python2.5/lib-tk', '/opt/python/python-2.5.1/lib/python2.5/lib-dynload', '/opt/python/python-2.5.1/lib/python2.5/site-packages'] from python shell: >>> import sys >>> sys.path ['', '/opt/apps/simple/feedparser-4.1-py2.5.egg', '/opt/apps/simple', '/opt/python/python-2.5.1/lib/python25.zip', '/opt/python/python-2.5.1/lib/python2.5', '/opt/python/python-2.5.1/lib/python2.5/plat-linux2', '/opt/python/python-2.5.1/lib/python2.5/lib-tk', '/opt/python/python-2.5.1/lib/python2.5/lib-dynload', '/opt/python/python-2.5.1/lib/python2.5/site-packages'] So I added the egg path explicitly to the apache PythonPath directive and now the modpython handler happily finds the module. So my modpython config is now... <Location "/simple"> PythonPath "['/opt/apps/simple/feedparser-4.1-py2.5.egg', '/opt/apps/simple'] + sys.path" SetHandler python-program PythonHandler handler PythonDebug On PythonInterpreter simple </Location> So I guess my question is now... do egg based modules need to be unzipped & explicitly mentioned on the python path? If so this seems to bypass all the pth stuff that egg versioning works off. thanks, Graham On Fri, 2007-09-14 at 08:28 +1000, Graham Dumpleton wrote: > Have you confirmed that in your application sys.path includes the > directory you expect to be there? > > What is the remainder of your Apache configuration for setting up > mod_python handler? Ie., what context are you setting PythonHandler > etc. > > Grahamd > > On 13/09/2007, Graham Carlyle <graham.carlyle at maplecroft.net> wrote: > > Hi > > > > I'm trying to setup an application via mod_python and want to place some > > required libraries, that are python eggs, on an application specific > > path. > > > > So I use... > > > > <LocationMatch ...> > > > > ... > > PythonPath "['/opt/apps/foo/lib/'] + sys.path" > > PythonInterpreter foo > > ... > > > > </LocationMatch> > > > > But the application doesn't pick up on the eggs that were installed in > > "/opt/apps/foo/lib/". Although the python shell can import the libs > > after setting PYTHONPATH to this path. > > > > However I can get the webapp to find the eggs if I add to the apache > > conf... > > > > PythonImport /opt/apps/foo/lib/site.py foo > > > > site.py being a file the easy_install created when i installed the eggs > > to the custom path. > > > > Is this the recommended way of installing eggs to a custom path? Are > > there problems with this "solution". > > > > I had a trawl and couldn't find any info on this sort of problem in the > > mailing list which surprised me. > > > > thanks, > > Graham > > > > > > _______________________________________________ > > Mod_python mailing list > > Mod_python at modpython.org > > http://mailman.modpython.org/mailman/listinfo/mod_python > >
|