[mod_python] cannot import mod_python.apache error

Gregory (Grisha) Trubetskoy grisha at modpython.org
Sun Feb 2 19:51:21 EST 2003


Someone else reported this "import site" problem, and as far as I can
remember it is actually a bug in Python, not mod_python - perhaps someone
can fill in the details?

Grisha

On Fri, 31 Jan 2003, ganapathy murali krishnan wrote:

>
> 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
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
>




More information about the Mod_python mailing list