problem with mod_python

Joshua Kugler jkugler at bigfoot.com
Tue Feb 19 14:04:47 EST 2008


Pradnyesh Sawant wrote:

> Hello,
> I have a small program which does 'import hashlib'. This program runs fine
> with python2.5. But when I try running the same program through
> mod_python, I get the error: 'ImportError: No module named hashlib' in the
> apache2 error.log
> 
> Searching online suggested me to include md5.so or md5module.so in
> apache2. but I don't see that in a package for debian lenny (the system
> I'm using).
> 
> So, my Q is, is it possible to make mod_python use the same PYTHONPATH as
> the python2.5 interpreter? if so, how?

It sounds like your mod_python may be compiled against a different version
of Python than your main installation?  How did you install mod_python? How
did you install your main python installation?

What is the output of the command:

ldd /path/to/mod_python.so

(the full path on my system is /usr/lib/apache2/mod_python.so)

There should be a line something like:

libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 (0xb7e37000)

If it is pointing to libpython.2.4.so.1.0, then that could be the reason for
you troubles.

Hope that helps.

j




More information about the Python-list mailing list