[mod_python] mod_python mysteriously stopped working under Windows

tpc at csua.berkeley.edu tpc at csua.berkeley.edu
Thu Oct 2 19:41:01 EST 2003

oh wow this problem again.  I am going to repost an email I sent to one
Kevin Douglas who kept hitting this same brick wall:

Date: Mon, 9 Jun 2003 14:37:28 -0700 (PDT)
From: tpc at csua.berkeley.edu
To: kevin douglas <fitnah55 at hotmail.com>
Cc: mod_python at modpython.org
Subject: RE: [mod_python] need working fix for 'import site' aka
    'ImportError'aka'make_obcallback' error

> -----
> 'import site' failed; use -v for traceback
> ImportError: No module named mod_python.apache
> [Sun Jun 08 00:06:50 2003] [error] make_obcallback: could not import
> mod_python.apache.
> -----

I had that exact same problem, although I did not spend as much time
trying to fix it as you apparently have.  I ended up just reinstalling
mod_python.  It works fine now, though I don't understand why it broke in
the first place.

if you search the archives you can find out how he resolved the problem,
which he ultimately did, as he recounted to us:

Date: Mon, 9 Jun 2003 23:38:36 -0400
From: kevin douglas <fitnah55 at hotmail.com>
To: mod_python at modpython.org
Subject: [mod_python]  working fix [FAQ: 'import site' failed; use -v for

as stated in the make_obcallback FAQ entry, this is a sys.path

the main problem (i believe) is that the path that is available at
runtime is not always the same as it was with the previous run of

with a linux distro that requires python as part of the base install
with a minimal install) - the python in /usr is going to supercede
the python in /usr/local even if the path properly includes /usr/lib
and site-packages/mod_python is pointed to properly

what you should do is axe all the python rpm's that you can
(python-base is required for libuser which is required for passwd)
and then take the file list from python-base and manually delete it
(/usr/lib/python2.2 and /usr/bin/python)

this will free up the proper /usr/local/lib/python2.2 to be first in
line in the path

what's confusing is that you link to /usr/local/bin/python2.2 explicitly
to compile mod_python, but it still ends up with /usr/lib/python2.2
as the primary lib source... and even if you get the paths added as the
other FAQ entry states - you're still going to be running the old
site.py from /usr/lib...

and to make matters even worse sometimes it randomly decides to work
even before you axe the default distro install..



As you can see something to do with paths and multiple Python versions
installed is the reason you are having trouble.

On Fri, 3 Oct 2003, Robert Leftwich wrote:

> I have this bizarre problem that is driving me insane. I had a working
> mod_python setup yesterday (W2000, Apache 2.0.47, python 2.3, mod_python
> 3.1.0a - all vanilla). I needed to combine 2 projects so I set out to
> create a new project directory structure and ran out of disk space on
> the c-drive while doing something unrelated to mod_python/apache/etc. I
> cleaned up a few directories (again unrelated) and ever since then I
> cannot get even the simplest mod_python setup to work. I've tried
> uninstalling/reinstalling everything, even reverting to python
> 2.2.3/mod_python3.0.3 all to no avail. No matter what I try (including
> explicitly setting PYTHONHOME=C:\Python23 and PYTHONPATH=C:\Python23\lib
> \site-packages;C:\Python23\lib (among other combinations) I get an error
> in the log file saying "[error] make_obcallback: could not import
> mod_python.apache.". Note that python 2.2.3/mod_python3.0.3 just does
> not work at all, no messages anywhere - it is as if it is totally
> ignored. Note also that straight python cgi (e.g. pyblosxom) is working
> fine. At the moment I'm using the httpd.conf settings and mptest.py
> straight from the Testing section of the manual.
> Can anyone shed light on this problem ?
> Robert
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list