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.

classification
Title: failure in urllib exception handling
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jhylton, nobody, rgbecker
Priority: normal Keywords:

Created on 2001-05-13 14:40 by rgbecker, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (3)
msg4745 - (view) Author: Robin Becker (rgbecker) Date: 2001-05-13 14:40
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
msg4746 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-05-16 08:34
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>
msg4747 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2001-08-30 20:30
Logged In: YES 
user_id=31392

No, this bug isn't present in 2.1.  It was fixed about six
months before this bug report was submitted.
History
Date User Action Args
2022-04-10 16:04:03adminsetgithub: 34498
2001-05-13 14:40:45rgbeckercreate