HELP: Python ASP Bug with traceback information

Joe Salmeri JoeSalmeri at home.com
Tue Jul 17 18:40:56 EDT 2001


Can someone please confirm whether this is a known bug using Python with
ASP?

Web Server is IIS 5.0
OS is Windows 2000 SP2
Python is BeOpen Python 2.0
Win32All is build 138

When an exception occurs in a script under ASP the contents of the line that
the traceback occurred on do not appear to exist in the traceback.
I have tried most of the functions available in the traceback module but in
all cases the contents of the line that normally appears in the
traceback is lost when using ASP.  When using CGI/Python there are no
problems.

I have narrowed down my problem to the simple test scripts listed below:

Have I found a new bug?  Is there a workaround available?


**** File 1:  joe.py ****
print 'Content-Type: text/html'
print

import StringIO
import sys
import traceback

try:
    1/0
except:
    e = sys.exc_info()
    f = StringIO.StringIO()
    traceback.print_exception(e[0], e[1], e[2], file=f)
    print f.getvalue()

**** File 2: joe.asp ****
<%@language="Python"%>

<%
import StringIO
import sys
import traceback

try:
    1/0
except:
    e = sys.exc_info()
    f = StringIO.StringIO()
    traceback.print_exception(e[0], e[1], e[2], file=f)
    Response.Write(f.getvalue())
%>

**** joe.py output ****
Traceback (most recent call last):
  File "P:\Home\Joe\Web\Rolo\j.py", line 10, in ?
    1/0
ZeroDivisionError: integer division or modulo

**** joe.asp output **** (NOTE: you must view source of the asp page because
I did not Encode the ASP output)
Traceback (most recent call last):
  File "<Script Block >", line 7, in ?
ZeroDivisionError: integer division or modulo
















More information about the Python-list mailing list