[Python-bugs-list] [ python-Bugs-423721 ] failure in urllib exception handling

noreply@sourceforge.net noreply@sourceforge.net
Wed, 16 May 2001 01:34:20 -0700


Bugs item #423721, was updated on 2001-05-13 07:40
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=423721&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robin Becker (rgbecker)
Assigned to: Nobody/Anonymous (nobody)
Summary: failure in urllib exception handling

Initial Comment:
This is observed sometimes using webchecker.py running python 2.0 under freeBSD 4.2
seems like urllib might checking strings against Exception instances

webchecker version 1.22

Round 1 (1 total, 1 to do, 0 done, 0 bad)


Round 2 (20 total, 19 to do, 1 done, 0 bad)


Round 3 (117 total, 97 to do, 20 done, 0 bad)


Saving checkpoint to @webchecker.pickle ...
Done.
Use ``/usr/local/lib/python2.0/Tools/webchecker/webchecker.py -R'' to
restart.
Traceback (most recent call last):
  File "/usr/local/lib/python2.0/Tools/webchecker/webchecker.py", line
824, in ?
    main()
  File "/usr/local/lib/python2.0/Tools/webchecker/webchecker.py", line
222, in main
    c.run()
  File "/usr/local/lib/python2.0/Tools/webchecker/webchecker.py", line
349, in run
    self.dopage(url)
  File "/usr/local/lib/python2.0/Tools/webchecker/webchecker.py", line
403, in dopage
    page = self.getpage(url_pair)
  File "/usr/local/lib/python2.0/Tools/webchecker/webchecker.py", line
496, in getpage
    f = self.openpage(url_pair)
  File "/usr/local/lib/python2.0/Tools/webchecker/webchecker.py", line
534, in openpage
    return self.urlopener.open(url)
  File "/usr/local/lib/python2.0/urllib.py", line 166, in open
    return getattr(self, name)(url)
  File "/usr/local/lib/python2.0/urllib.py", line 457, in open_ftp
    (fp, retrlen) = self.ftpcache[key].retrfile(file, type)
  File "/usr/local/lib/python2.0/urllib.py", line 692, in retrfile
    if reason[:3] != '550':
TypeError: sequence index must be integer

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

Comment By: Nobody/Anonymous (nobody)
Date: 2001-05-16 01:34

Message:
Logged In: NO 

"reason" is an ftp error exception instance, which
doesn't support slicing.  changing this to

    if str(reason)[:3] != "550"

should work.

is this bug still present in 2.1?  (only have 2.0 on
the box I'm typing this on)

</F>

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

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