[mod_python] mod_python startup error

Graham Dumpleton grahamd at dscpl.com.au
Sat Jul 16 08:27:08 EDT 2005

Presuming that the location '/python' maps to a physical directory
called '/var/www/html/python', try instead using:

   <Directory /var/www/html/python>
   SetHandler python-program
   PythonHandler mod_python.publisher

When <Location> is used, there is no associated physical directory
and therefore mod_python can't know what directory to add to the
PythonPath (sys.path) for you.

Only problem with this theory as I just realised though is that
mod_python.publisher shouldn't be relying on sys.path to load the
actual modules. It will instead explicitly provide the directory
to apache.import_module(). In other words, it should work okay
how you had it.

What was the URL you were using to access the page? Do you know
if "MultiViews" Apache option is enabled or disabled for that


On 16/07/2005, at 10:09 PM, Wouter van Marle wrote:

> Graham,
> Here the relevant details:
> in httpd2.conf one line:
> LoadModule python_module        extramodules/mod_python.so
> In 16_mod_python.conf:
> <Location /python>
>     SetHandler python-program
>     PythonHandler mod_python.publisher
> </Location>
> After dinner I'm going to look into this more! This is the current
> setup.
> Wouter.
> On Sat, 2005-07-16 at 21:41 +1000, Graham Dumpleton wrote:
>> Have you specified:
>>    PythonHandler mod_python.publisher
>> within a <Directory> directive or in a .htaccess file?
>> If you haven't and you instead put it at global scope or within a
>> <Location> directive, you can have such problems because PythonPath
>> will not be automatically extended with the name of the directory
>> for which PythonHandler is specified.
>> Alternatively, are you setting PythonPath explicitly in any way?
>> Setting PythonPath explicitly can also override the automatic addition
>> of the PythonHandler directive to PythonPath and again module will
>> not be able to be found.
>> You might want to post the snippet of Apache configuration where you
>> setup use of mod_python. There is no need to send the whole Apache
>> configuration, just the relevant bit, ensuring though you show any
>> context it is set within, such as <Location>, <Directory> when it
>> is appropriate.
>> Graham
>> On 16/07/2005, at 9:27 PM, Wouter van Marle wrote:
>>>  Hi all,
>>>  After an upgrade to Mandrake 10.2, mod_python shows the following
>>> error:
>>>  Mod_python error: "PythonHandler mod_python.publisher"
>>> Traceback (most recent call last):
>>>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
>>> 299, in HandlerDispatch
>>>     result = object(req)
>>>   File "/usr/lib/python2.4/site-packages/mod_python/publisher.py",
>>> line 98, in handler
>>>     path=[path])
>>>   File "/usr/lib/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
>>>> From my address bar I can see that this is before the very first
>>> page (an html page that redirects to the python based content and
>>> thereby changes the url in the address bar). Any idea what's going
>>> wrong here?
>>>  The software, from rpm packages:
>>>  apache2-2.0.53-9mdk
>>>  apache2-mod_python-2.0.53_3.1.4-4mdk
>>>  python-base-2.4.1-2mdk
>>>  python-2.4.1-2mdk
>>>  Wouter. _______________________________________________
>>> Mod_python mailing list
>>> Mod_python at modpython.org
>>> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list