[Python-bugs-list] [ python-Bugs-654558 ] make error reporting better like cgi

SourceForge.net noreply@sourceforge.net
Thu, 23 Jan 2003 15:20:35 -0800


Bugs item #654558, was opened at 2002-12-16 06:33
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=654558&group_id=5470

Category: Python Interpreter Core
Group: Feature Request
Status: Open
Resolution: None
>Priority: 7
Submitted By: Hunter Peress (hfastedge)
Assigned to: Nobody/Anonymous (nobody)
Summary: make error reporting better like cgi

Initial Comment:
do something bad in something that uses cgitb, it will
show you actual values of the variables at that point
in the error message....and a host of useful info.

I think this should be done normally as well.

----------------------------------------------------------------------

>Comment By: Hunter Peress (hfastedge)
Date: 2003-01-23 18:20

Message:
Logged In: YES 
user_id=479934

HOW TO REPRODUCE:

We are going to test a basic piece of logic. In normal
interpreter (from cmdline), and in cgi mode. We will see
just how different the error reporting is:

<b>FIRST the basic LOGIC:
l=[1,2,3,4,5]
for i in range(len(l)):
    print i,l[i],l ; del l[i]

Next implement it in CGI:
#!/usr/bin/python2.2
import sys,commands,os,re,string,cgi,cgitb
cgitb.enable(1)
print "Content-type: text/html\n\n"
LOGIC GOES HERE

NOW Observe how nice the error is:
 /home/hperes/public_html/cgi-bin/cgiShow.cgi
    4 print "Content-type: text/html\n\n"
    5 print "HI"
    6 l=[1,2,3,4,5]
    7 for i in range(len(l)):
    8     print i,l[i],l ; del l[i]
i = 3, l = [2, 4]

IndexError: list index out of range
      __doc__ = 'Sequence index out of range.'
      __getitem__ = <bound method IndexError.__getitem__ of
<exceptions.IndexError instance at 0x8185c14>>
      __init__ = <bound method IndexError.__init__ of
<exceptions.IndexError instance at 0x8185c14>>
      __module__ = 'exceptions'
      __str__ = <bound method IndexError.__str__ of
<exceptions.IndexError instance at 0x8185c14>>
      args = ('list index out of range',) 

See how you can see the values of all the variables on the
line??


Next implement it in cmdline:
0 1 [1, 2, 3, 4, 5]
1 3 [2, 3, 4, 5]
2 5 [2, 4, 5]
3
Traceback (most recent call last):
  File "s", line 5, in ?
    print i,l[i],l ; del l[i]
IndexError: list index out of range


See how much more useless that is?


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=654558&group_id=5470