[Python-checkins] CVS: python/dist/src/Tools/webchecker webchecker.py,1.24,1.25

Guido van Rossum gvanrossum@users.sourceforge.net
Tue, 11 Dec 2001 14:41:27 -0800


Update of /cvsroot/python/python/dist/src/Tools/webchecker
In directory usw-pr-cvs1:/tmp/cvs-serv9982

Modified Files:
	webchecker.py 
Log Message:
Fix SF bug #482171: webchecker dies on file: URLs w/o robots.txt

The cause seems to be that when a file URL doesn't exist,
urllib.urlopen() raises OSError instead of IOError.  Simply add this
to the except clause.  Not elegant, but effective. :-)


Index: webchecker.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/webchecker.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** webchecker.py	2001/04/05 18:14:50	1.24
--- webchecker.py	2001/12/11 22:41:24	1.25
***************
*** 336,340 ****
          try:
              rp.read()
!         except IOError, msg:
              self.note(1, "I/O error parsing %s: %s", url, msg)
  
--- 336,340 ----
          try:
              rp.read()
!         except (OSError, IOError), msg:
              self.note(1, "I/O error parsing %s: %s", url, msg)
  
***************
*** 534,538 ****
          try:
              return self.urlopener.open(url)
!         except IOError, msg:
              msg = self.sanitize(msg)
              self.note(0, "Error %s", msg)
--- 534,538 ----
          try:
              return self.urlopener.open(url)
!         except (OSError, IOError), msg:
              msg = self.sanitize(msg)
              self.note(0, "Error %s", msg)