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

Graham Dumpleton grahamd at dscpl.com.au
Tue Apr 26 17:34:48 EDT 2005


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.

Graham



More information about the Mod_python mailing list