[mod_python] Internal Server Error

Graham Dumpleton grahamd at dscpl.com.au
Tue Jun 28 20:40:04 EDT 2005


Julien wrote ..

> 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 :

Are you using "index.py" in multiple directories, especially in directories
that are children of a parent that also uses that filename. If so, you may
be getting affected by:

  http://issues.apache.org/jira/browse/MODPYTHON-9

When you get a child directory module get stuck as described, if you
then access a parent directory module, the function you want will not be
able to be found and it may manifest with the error you see.

Not sure though, as PythonInterpPerDirectory should possibly avoid the
problem and I would also possibly have expected a not found error
instead of a 500 error.

You might also indicate if you explicitly use the PythonPath directive,
whether you use packages, whether a module or package is imported
both using "import" statement as well as "apache.import_module()"
and finally whether you have Apache "MultiViews" option enabled for
the directory. Use of all these can trigger strange things in certain
cases so more information about these might help to track it down.

> import os.path

You don't need to explictly import "os.path", it is sufficient to import just "os"
as it will import approriate module as "path". I only mention this as there is an
obtuse comment in Python source code which suggests that import "os.path"
may be frowned upon and a special check required because people do do it.

        # Grrr, some people "import os.path"
        if len(parts) == 2 and hasattr(top_module, parts[1]):
            return top_module

Graham


More information about the Mod_python mailing list