[mod_python] psp.PSP(req, string='hello world') causes segfault

dharana dharana at dharana.net
Tue Apr 26 17:51:03 EDT 2005



Graham Dumpleton wrote:
> 
> On 27/04/2005, at 7:20 AM, dharana wrote:
> 
>> I'm using a custom handler which has just this:
>>
>> -- (webapps/admin/)controller.py ----------
>> from mod_python import *
>>
>> def handler(req):
>>     content_file = psp.PSP(req, string='hello world')
>>     return
> 
> 
> Unlikely to be the cause of your problem, but you could clean this up a 
> bit.
> First don't use "from mod_python import *". Safer to use:
> 
>   from mod_python import apache
>   from mod_python import psp
> 
>   def handler(req):
>     content_file = psp.PSP(req, string='hello world')
>     return apache.OK
> 
> Import everything from mod_python will really pollute your module.  The
> second thing was that you should return apache.OK and not None as later
> can result in 500 HTTP error occurring.
> 
> I know you are probably trying to debug the problem and have cut things
> down, but I think you are also missing:
> 
>   content_file.run()
> 
> Without that, nothing of the template will get displayed anyway.


I had it setup like this as you know, I just tried to skip any module 
loading problem and to simplify it as much as I could.

I've a tail -f to the apache log file in a secondary console anyways.

--- newversion.py -----------
from mod_python import apache
from mod_python import psp

def handler(req):
     content_file = psp.PSP(req, string='hello world')
     content_file.run()
     return apache.OK
-----------------------------


It still segfaults. I'm running it on a debian box, but I remember 
experiencing this same problem months ago in another different server 
(both hardware and distro, it was gentoo 2004). Please, can anyone check 
if this happens to you too? I find it hard to believe it's 
dharana-specific if it happens in two completely different servers.

-
dharana



More information about the Mod_python mailing list