[mod_python] patch to use Py_SetProgramName()

Graham Dumpleton graham.dumpleton at gmail.com
Wed Mar 26 16:15:51 EDT 2008


On 27/03/2008, Glen W. Mabey <Glen.Mabey at swri.org> wrote:
> On Wed, Mar 26, 2008 at 02:59:46PM -0500, Graham Dumpleton wrote:
>  > On 27/03/2008, Glen W. Mabey <Glen.Mabey at swri.org> wrote:
>  > > Hello,
>  > >
>  > >  I started getting some weird crashes of mod_python when I started using
>  > >  it on a ubuntu box.
>  > >
>  > >  I'm attaching a patch for version 3.3.1 which isn't properly integrated
>  > >  with the configure script and the Makefile, but I hope it makes sense.
>  >
>  > Sorry, you will need to explain properly the problem you claim this fixes.
>
>
> Fair enough.  The error in the log file looks like this:
>
>
>  [Wed Mar 26 13:57:19 2008] [error] [client 129.162.166.114] PythonHandler mod_python.cgihandler:   File "random.py", line 43, in <module>\n    from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
>  [Wed Mar 26 13:57:19 2008] [error] [client 129.162.166.114] PythonHandler mod_python.cgihandler: ImportError: /usr/lib/python2.5/lib-dynload/math.so: undefined symbol: PyFPE_jbuf
>
>
>  So, I realized that somehow it was starting to use a different python
>  than what I had specified via --with-python in configure.  That is, I
>  had done all I could to make it so that mod_python used a python
>  installed into /usr/local/{bin,lib}/, but it was using modules out of
>  /usr/lib/.  The embedding API now provides a function to precisely
>  specify which python should be used, as explained at
>
>   http://docs.python.org/api/embedding.html
>
>  with the Py_SetProgramName() function.  Since configure is already
>  getting this value explicitly (when --with-python is used), it seems to
>  me that it would be desirable to employ this facility instead of letting
>  Py_Initialize() search around for what it decides is the most
>  appropriate executable.
>
>  Is that reasonable?

Except that it doesn't work for Windows or MacOS X.

Anyway, see:

  http://issues.apache.org/jira/browse/MODPYTHON-225

It also talks about workaround of setting PYTHONEXECUTABLE or
PYTHONHOME environment variables in 'envvars' file or Apache startup
script.

Graham


More information about the Mod_python mailing list