By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,131 Members | 1,494 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,131 IT Pros & Developers. It's quick & easy.

mod_python and Internal Server Error ...

P: n/a
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
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.