[mod_python] cannot import mod_python.apache error

ganapathy murali krishnan gmurali at cs.uchicago.edu
Fri Jan 31 14:20:54 EST 2003


I just installed Python-2.3a1 + apache 2.0.44 + mod_python 3.0.1.
I have one vhost (say vhost) in addition to the main one (say mainhost).
The vhost has a python program as the main handler (using SetHandler).
This setup works correctly without any problems on another machine
(Python 1.5+ apache 1.3 + mod_python something), so the problem is not 
in the handler code itself.

When I run the httpd binary, all is fine. The mainhost serves up html 
files without any problems. The vhost is supposed to serve up .py files.
When I go to "http://vhost" I get the following error.

----
[Fri Jan 31 13:53:00 2003] [error] make_obcallback: could not import 
mod_python.apache.

'import site' failed; use -v for traceback
ImportError: No module named mod_python.apache
----

The apache.py is in 
/opt/python/default/lib/python2.3/site-packages/mod_python/apache.py.

I tried many of the suggested workarounds, I couldn't get any of them
to work. The content of my httpd.conf inside the <VirtualHost> and 
</VirtualHost> is enclosed below.

------------
   SetHandler python-program
   PythonDebug on
   # All handlers are stored in a different directory, for security
   PythonPath "sys.path+['/stage/w3serv/vhost.cs.uchicago.edu']"

   # This module handles reloading modules on demand
   PythonInitHandler handlers.init

   # Fire up the first Python handler
   PythonTransHandler handlers.translate

   # Logging configuration
   # PythonOption Log off
   PythonOption Log /stage/w3serv/vhost/logs/debug.log
   # Tell the Python site to ignore these paths, 

   PythonOption DontHandle /icons:/images:/~:/i/:/files/:/pipermail 

   # Tell the Python handler to ignore these extensions 

   PythonOption DontHandleExt html:htm:php:php3:phps:php4:cgi 

 

   # Then tell Apache how to handle them. 

   Alias /icons /stage/w3serv/common/docs/icons 

   Alias /images /stage/w3serv/common/docs/images 

   UserDir disable 

-----

Any help would be appreciated.

- Murali




More information about the Mod_python mailing list