[mod_python] Mysterious 500 error? Solved!

Peter Shinners pete at shinners.org
Mon Jul 16 02:37:38 EDT 2007

Peter Shinners wrote:
> def handler(req):
>     path = req.uri.split("/", 2)[-1]
>     if path == "magic.html":
>         req.content_type = "text/html"
>         req.status = apache.OK
>         req.send_http_header()
>         req.write("<html><body>It is ok</body></html>")
>         return apache.OK

Found and fixed the problem. Just setting request.status seems to 
desginate an error. Even if setting to apache.OK. By not setting any 
status when things are ok, I get clean and clear 200 statuses.

More information about the Mod_python mailing list