[mod_python] importing errno

Michael McKerns mmckerns at its.caltech.edu
Tue Jun 10 08:53:41 EST 2003


The following is a problem with the RedHat8 rpm's, but
also may apply to the source.  I thought I'd kick it out
to see if somebody has gone through this already, or if
the new source takes care of this...
-------------------------------------

In python2.1, "import errno" looked for
/usr/lib/python2.1/lib-dynload/errno.so

In python2.2, errno.so was moved to a built-in module.

Using the most current rpm builds from RHN for RedHat8
(python-2.2.2-7, mod_python-3.0.0-10, httpd-2.0.40-11.5),
the following causes an error because apache (?) looks to the
old location of errno.so when browser pointed to pyweb.py URL.

I'm assuming that RedHat is just a little behind, but I could be wrong.
I guess I will try to build from source from the latest
versions on the mod_python website to see if this bug
has been fixed, and if it is just a redhat rpm bug...



EXAMPLE:
---------------------------------------------
#! /usr/bin/env python
############################################################
# pyweb.py              06/09/03        mmckerns at caltech.edu
# testing python web handler
############################################################

# the next line causes the error...
import errno

from mod_python import apache

def handler(req):
        req.content_type = "text/plain"
        req.write("Hello World Wide Web!")
        return apache.OK

---------------------------------------------



FROM httpd.conf:
---------------------------------------------
LoadModule python_module modules/mod_python.so

<Directory /home/mmckerns/public_html>
        AddHandler python-program .py
        PythonHandler pyweb
        PythonPath "sys.path+['/home/mmckerns/public_html']"
        PythonDebug On
</Directory>
---------------------------------------------




ERROR FROM error_log:
----------------------------------------------
[Mon Jun 09 14:13:34 2003] [error] PythonHandler pyweb: Traceback (most
recent c
all last):
[Mon Jun 09 14:13:34 2003] [error] PythonHandler pyweb:   File
"/usr/lib/python2
.2/site-packages/mod_python/apache.py", line 274, in HandlerDispatch!
module
= import_module(module_name, _req)
[Mon Jun 09 14:13:34 2003] [error] PythonHandler pyweb:   File
"/usr/lib/python2
.2/site-packages/mod_python/apache.py", line 429, in import_module!
module =
imp.load_module(mname, f, p, d)
[Mon Jun 09 14:13:34 2003] [error] PythonHandler pyweb:   File
"/home/mmckerns/p
ublic_html/pyweb.py", line 5, in ?!    import errno
[Mon Jun 09 14:13:34 2003] [error] PythonHandler pyweb: ImportError: No
module n
amed errno
----------------------------------------------




---

Mike McKerns
mmckerns at caltech.edu







More information about the Mod_python mailing list