Reassigning sys.excepthook does not appear to work in PyApache interpreters. If an exception is raised, the script quits without returning any data or any error/traceback content.
Running the same script as a plain CGI works as expected.
This is on Python 2.1.2, Apache 1.3.20, PyApache 4.25. (Can't DL 4.26 to test ATM - SourceForge seems to be playing up.)
It would be a real shame if this couldn't be made to work, as it's very useful for Apache users to test scripts. (Checking the error log every time can get really tedious.)
Does anyone have any clue where to start looking to work out a fix?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2002-05-08
I've been using "cgitb.py" (see http://web.lfw.org/python/\), the recommended approach to which is to create a file "sitecustomize.py" in the site-packages directory, with contents as follows:
import os
if os.environ.has_key("DOCUMENT_ROOT"):
import sys, cgitb
sys.excepthook = cgitb.excepthook
It works for me under Python 2.1, sorry I can't be more helpful. Working proof is on:
BTW, cgitb is now part of the Python2.2 official distro, if you're interested.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2002-05-08
Notes: 1) the sitecustomize content had its
indentation removed when I posted and 2) you'll need
to View Source on the example to get a clear view of the output (white font on white background, sorry).
I usually only use cgitb on the development server, any 505 errors on the live server result in an automated email sent to me of the tail of the server's error log and a form presented to the user so they can ask to be informed when the problem is fixed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Reassigning sys.excepthook does not appear to work in PyApache interpreters. If an exception is raised, the script quits without returning any data or any error/traceback content.
Running the same script as a plain CGI works as expected.
This is on Python 2.1.2, Apache 1.3.20, PyApache 4.25. (Can't DL 4.26 to test ATM - SourceForge seems to be playing up.)
It would be a real shame if this couldn't be made to work, as it's very useful for Apache users to test scripts. (Checking the error log every time can get really tedious.)
Does anyone have any clue where to start looking to work out a fix?
I've been using "cgitb.py" (see http://web.lfw.org/python/\), the recommended approach to which is to create a file "sitecustomize.py" in the site-packages directory, with contents as follows:
import os
if os.environ.has_key("DOCUMENT_ROOT"):
import sys, cgitb
sys.excepthook = cgitb.excepthook
It works for me under Python 2.1, sorry I can't be more helpful. Working proof is on:
http://www.bel-epa.com/pyapache/resources/cgitb_demo.py
BTW, cgitb is now part of the Python2.2 official distro, if you're interested.
Notes: 1) the sitecustomize content had its
indentation removed when I posted and 2) you'll need
to View Source on the example to get a clear view of the output (white font on white background, sorry).
I usually only use cgitb on the development server, any 505 errors on the live server result in an automated email sent to me of the tail of the server's error log and a form presented to the user so they can ask to be informed when the problem is fixed.