[mod_python] importing egg format libs installed on a custom path

Graham Dumpleton graham.dumpleton at gmail.com
Fri Sep 14 07:23:48 EDT 2007


On 14/09/2007, Graham Carlyle <graham.carlyle at maplecroft.net> wrote:
> On Fri, 2007-09-14 at 19:59 +1000, Graham Dumpleton wrote:
> > >From command line Python, are you perhaps using 'workingenv' system of
> > some variety? The activation step required for some of these may not
> > be compatible with mod_python.
>
> No just a plain python install to a custom location as I don't want to
> use the distros version. So I set PYTHONHOME in the apachectl script

The 'envvars' script in same directory should be used for setting
special environment variables. Shouldn't modify apachectl directly.
Check apachectl though to ensure it is reading this file from that
location.

> so
> that modpython uses the correct version (I obviously needed to compile
> the apache module against this version of python as well). I did this
> after reading https://issues.apache.org/jira/browse/MODPYTHON-225 and
> that seems to work fine.
>
> The only problem is with eggs installed on a path outside site-packages
> that I'm pointing to with PythonPath. Seems I need to reference these
> sort of eggs explicitly on PythonPath to make them importable from the
> modpython handler. If the egg is installed in site-packages then it can
> be imported with no problem and no need to add the egg to the
> PythonPath.

Set PYTHONPATH in the envvars file as well. That way it will be
present when Python first starts up and eggs will be activated
properly (I think).

Graham


More information about the Mod_python mailing list