Python ASP Bug with traceback information

Joe Salmeri JoeSalmeri at home.com
Tue Jul 17 20:54:00 EDT 2001


Mark,

Thanks.  I was going crazy fighting that one.

While I waiting/hoping you would reply I ran across something interesting.

When I created my test cases I tried to narrow things down to as small a
chuck of code as possible.

In the real world here is what I am doing:

*** Joe.ASP ***
try:
    import exception_handler
    import joe

    joe.dosomething()
except:
    exception_to_handle = sys.exc_info()
    exception_handler.exception_handler(Server, Application, Session,
Request, Response, exception_to_handle)
*** End of Joe.ASP ***

Using this method I have been able to print out complete traceback
information.

Strange or could it be because the code has moved out of the ASP file and
into a py module?

P.S.  The HTTP Server error that we talked about still happens.  When 2.1.1
is released I am going to upgrade and see if that fixes the problem.
P.S.S.  It does not have to do with old installs because I bought a new
machine so everything was a fresh install.
"Joe Salmeri" <JoeSalmeri at home.com> wrote in message
news:Y9357.17749$Ek3.6722336 at news1.rdc1.md.home.com...
> 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