Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f0953b9

Browse files
committed
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. :-)
1 parent 3a8e59e commit f0953b9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Tools/webchecker/webchecker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def addrobot(self, root):
335335
rp.set_url(url)
336336
try:
337337
rp.read()
338-
except IOError, msg:
338+
except (OSError, IOError), msg:
339339
self.note(1, "I/O error parsing %s: %s", url, msg)
340340

341341
def run(self):
@@ -533,7 +533,7 @@ def openpage(self, url_pair):
533533
url, fragment = url_pair
534534
try:
535535
return self.urlopener.open(url)
536-
except IOError, msg:
536+
except (OSError, IOError), msg:
537537
msg = self.sanitize(msg)
538538
self.note(0, "Error %s", msg)
539539
if self.verbose > 0:

0 commit comments

Comments
 (0)