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

SourceForge.net noreply@sourceforge.net
Mon, 16 Jun 2003 11:35:37 -0700


Bugs item #654558, was opened at 2002-12-16 05:33
Message generated for change (Comment added) made by montanaro
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=654558&group_id=5470

>Category: Python Library
Group: Feature Request
>Status: Closed
>Resolution: Duplicate
Priority: 5
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: Skip Montanaro (montanaro)
Date: 2003-06-16 13:35

Message:
Logged In: YES 
user_id=44345

duplicate of 569574


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

Comment By: Michael Hudson (mwh)
Date: 2003-01-24 11:46

Message:
Logged In: YES 
user_id=6656

OK, but we don't use priorities like that in this project. 
All it acheives is winding people up.

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

Comment By: Hunter Peress (hfastedge)
Date: 2003-01-24 11:36

Message:
Logged In: YES 
user_id=479934

montanaro: FIRST, I put the priority on 9 because I finally
added a huge chunk of code to show what I was talking about.
Given this , and since this bug was in the system for so
long, I flagged it to 9, solely so that it would reget some
needed attention, and then  expecting one of the powers that
be to bring it back down to normal.

WELL: not only did you not do this. You closed the bug, AND
you completely did not comprehend what its point is.

Quickly: i show the the STRENGTHS of  the error reporting
mechanism in cgitb, and this bug suggests that some (if not
all) features should be implemented in the normal interpreter.

Most useful is the fact that you get to see values of all
variables on the line causing error.

As you can see, i reflagged this to 9 solely to get your
attention. please bring it back down to 5 when u read this.

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

Comment By: Skip Montanaro (montanaro)
Date: 2003-01-24 11:17

Message:
Logged In: YES 
user_id=44345

Please don't needlessly boost priorities.  This is hardly of highest priority (it doesn't crash the interpreter, for example).

The issue of invoking cgitb functionality automatically was discussed at length when the module was first added to the system.  It was decided that the possibility for breakage was too great.  After all, other people have almost certainly had to address this problem in their own cgi scripts.  Invoking cgitb may thwart those mechanisms, or worse, present clues about
the internal workings of the system which would give bad guys help 
breaking into systems.

In short, feel free to import cgitb into your own cgi scripts, but don't
force others to use it if they choose not to.

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

Comment By: Hunter Peress (hfastedge)
Date: 2003-01-23 17: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