[mod_python] Trying to get new importer working

Jim Geist jimge at rodentia.net
Wed Apr 9 01:24:02 EDT 2008


On Apr 8, 2008, at 10:11 PM, Graham Dumpleton wrote:

> 2008/4/9 Jim Geist <jimge at rodentia.net>:
>> Hi all -
>>
>> I am trying to convert my project over from using sys.path to use  
>> the new
>> importer and I'm having some issues. In my apache config I have this
>>
>> <Location /test>
>>    SetHandler mod_python
>>    PythonOption mod_python.importer.path "['/home/jimge/app']"
>>    PythonHandler entry
>>    PythonDebug On
>> </Location>
>>
>> /home/jimge/app/entry.py contains (well, more code, but it boils  
>> down to)
>>
>> from mod_python import apache
>> def handler(req):
>>    req.write("hello, world!\n")
>>    return apache.OK
>>
>> When I was using PythonPath to set up sys.path everything worked.  
>> With this
>> setup I get an ImportError exception that entry cannot be found.
>>
>> Anyone have any hints?
>
> Please post the complete Python exception message and any other logged
> messages associated with it form the Apache error log and/or web page.
> It will save us guessing.
>
> Graham

Sure. Here's the traceback from the browser:

Mod_python error: "PythonHandler entry"

Traceback (most recent call last):

   File "/usr/lib/python2.5/site-packages/mod_python/apache.py", line  
287, in HandlerDispatch
     log=debug)

   File "/usr/lib/python2.5/site-packages/mod_python/apache.py", line  
461, in import_module
     f, p, d = imp.find_module(parts[i], path)

ImportError: No module named entry

In the Apache error log:

[Wed Apr 02 05:26:09 2008] [notice] mod_python: (Re)importing module  
'entry'
[Wed Apr 02 05:26:09 2008] [error] [client 10.211.55.2] PythonHandler  
entry: Traceback (most recent call last):
[Wed Apr 02 05:26:09 2008] [error] [client 10.211.55.2] PythonHandler  
entry:   File "/usr/lib/python2.5/site-packages/mod_python/apache.py",  
line 287, in HandlerDispatch\n    log=debug)
[Wed Apr 02 05:26:09 2008] [error] [client 10.211.55.2] PythonHandler  
entry:   File "/usr/lib/python2.5/site-packages/mod_python/apache.py",  
line 461, in import_module\n    f, p, d = imp.find_module(parts[i],  
path)
[Wed Apr 02 05:26:09 2008] [error] [client 10.211.55.2] PythonHandler  
entry: ImportError: No module named entry

-- Jim




More information about the Mod_python mailing list