This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hfastedge
Recipients
Date 2003-01-23.23:20:35
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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?
History
Date User Action Args
2007-08-23 14:09:24adminlinkissue654558 messages
2007-08-23 14:09:24admincreate