[mod_python] error with test template system

Graham Dumpleton grahamd at dscpl.com.au
Sun May 14 16:33:46 EDT 2006

On 13/05/2006, at 9:44 AM, David Bear wrote:

> On Sat, May 13, 2006 at 09:08:05AM +1000, Graham Dumpleton wrote:
>> On 13/05/2006, at 7:00 AM, David Bear wrote:
>>> I downloaded the sample template system from
>>> http://www.modpython.org/examples/
>>> and placed it in a directory where publisher was set to be the .py
>>> handler.
>>> However, when I open the sample index.py file, modpython returns an
>>> error that there is no module named index. I am using modpython  
>>> 3.1.3
>>> (rpm packaged by suse) and apache 2.0.53.
>>> I know modpython is handling the request since I get a regular  
>>> python
>>> traceback when viewing the page through my web browser.
>>> Is there something simple that I have missed?
>> It will help if you send the exact text of the error with at least
>> the few most
>> inner frames in the traceback. Also send the Apache configuration
>> snippet
>> (not whole configuration) that you have used to enable mod_python for
>> the example. Also indicate whether mod_python is used by anyone else
>> of the server and whether the PythonPath directive has been set  
>> anywhere
>> at all in the Apache configuration. Finally, before you tried this
>> example,
>> did you try your own hello world example first.
> yes. I did the hello world example. It works.
> here's the traceback:
> =================================
> Mod_python error: "PythonHandler mod_python.publisher"
> Traceback (most recent call last):
>   File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line
> 299, in HandlerDispatch
>     result = object(req)
>   File "/usr/lib64/python2.4/site-packages/mod_python/publisher.py",
> line 98, in handler
>     path=[path])
>   File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line
> 454, in import_module
>     f, p, d = imp.find_module(parts[i], path)
> ImportError: No module named index
> ==================================
> Here's the configuration directive:
> <Directory "/work/servers/www/htdocs/mp">
>  AddHandler python-program .py
>  PythonHandler mod_python.publisher
>  PythonDebug On
> </Directory>

Are the files in the directory readable by others? The Apache server  
runs as a special user, if that user doesn't have read access to the  
and files, it will not be able to find the files.

Also, do you have an appropriate Alias directive to map URL namespace to
that actual directory, or does that directory lie under the document  
What is the actual URL you are using?


More information about the Mod_python mailing list