[mod_python] Internal Server Error

Julien jcigar at ulb.ac.be
Tue Jun 28 09:13:40 EDT 2005


Hello,

I'm using mod_python 3.1.3 with Apache 2.0.54 on a Debian box with the
publisher handler and the Clearsilver template engine, and from time to
time apache returns an 500 error code (Internal Server Error). 
Apache errog.log file looks like :

[Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
mod_python.publisher: Traceback (most recent call last):
[Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
mod_python.publisher:   File
"/usr/lib/python2.3/site-packages/mod_python/apache.py", line 299, in
HandlerDispatch\n    result = object(req)
[Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
mod_python.publisher:   File
"/usr/lib/python2.3/site-packages/mod_python/publisher.py", line 98, in
handler\n    path=[path])
[Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
mod_python.publisher:   File
"/usr/lib/python2.3/site-packages/mod_python/apache.py", line 454, in
import_module\n    f, p, d = imp.find_module(parts[i], path)
[Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
mod_python.publisher: ImportError: No module named taxal

...

What is strange is that when I reload the page, it's displayed fine, but
from time to time I get 500 error code ... which is quite annoying ...

As I'm using the publisher handler, my index.py looks like :

import sys
import os.path
import neo_cgi
import neo_util
import neo_cs

from mod_python import util, apache
from psycopg import QuotedString

config = apache.import_module('config', autoreload = 0, log = 0)
utils = apache.import_module('utils', autoreload = 0, log = 0)
specimen = apache.import_module('specimen', autoreload = 0, log = 0)
taxon = apache.import_module('taxon', autoreload = 0, log = 0)
fulltextsearch = apache.import_module('fulltextsearch', autoreload = 0,
log = 0)

template_directory  = config.getTemplateDirectory()
template_main       = config.getTemplateMain()
template_menu       = config.getTemplateMenu()

def index(req):
    return home(req)

def home(req):
    return _render(req, 'home')

def links(req):
    return _render(req, 'links')

def contact(req):
    return _render(req, 'contact')

def taxal(req):
    sort    = req.form.getfirst('sort')
    order   = req.form.getfirst('order')

    tl = taxon.taxon()
    tl.getTaxaList(sort, order)
    hdf = tl.getHDF()
    return _render(req, 'taxalist', hdf)

(...)

So for the above example if I GET http://b.abc.be/birds/taxal it should
run the "def taxal(req)" function ... I don't understand why I get a
"mod_python.publisher: ImportError: No module named taxal" error message
in the apache logfile.

We have several virtualhosts : a.abc.be, b.abc.be, c.abc.be, ...
(fictive addresses). Our www directory is organized like this :
/var/www/vhosts/a.abc.be/ 
/var/www/vhosts/b.abc.be/
/var/www/vhosts/b.abc.be/enbi/
/var/www/vhosts/b.abc.be/enbi/projects/birds/
/var/www/vhosts/b.abc.be/enbi/projects/butterfly/
/var/www/vhosts/b.abc.be/enbi/projects/rubiaceae/
/var/www/vhosts/c.abc.be/blah/

I've tried with "PythonInterpPerDirectory on" in my .htaccess, but
without success ...

In advance thanks for your support

-- 
Julien Cigar (jcigar at ulb.ac.be)
Belgian Biodiversity Information Facility
Université Libre de Bruxelles
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
http://www.bebif.be



More information about the Mod_python mailing list