my solution to "could not import mod_python.apache" problem

dl d500l at yahoo.com
Mon Dec 30 17:18:59 EST 2002


I had this already discussed problem with Apache 2.0.43 and mod_python
3.0.1 on win32 machines. Even the simplest python "hello world" script
could not load:

make_obcallback(): could not import mod_python.apache

I finally found that unless you have PYTHONHOME environment variable
defined, python22.dll resolves python's location by the path of the
executable, i.e. process host (in this case apache.exe). The
python22.dll code does not use the paths stored in win32 registry for
this. Well, it would not be the first time to be blind ;)

After setting up this simple batch file to start Apache, everything
worked without any problem:

c:
REM apache install directory
cd "\Program Files\Apache Group\Apache2"
REM python 2.2.2 install directory
set PYTHONHOME=c:\python22 
bin\Apache -w -f conf\httpd.conf -d .

Hope this my 2c saves some hours of frustrating resolving for someone.



More information about the Python-list mailing list