[Pywikipedia-l] SVN: [5357] trunk/pywikipedia/weblinkchecker.py
nicdumz at svn.wikimedia.org
nicdumz at svn.wikimedia.org
Mon May 12 16:17:13 UTC 2008
Revision: 5357
Author: nicdumz
Date: 2008-05-12 16:17:13 +0000 (Mon, 12 May 2008)
Log Message:
-----------
Trying to fix bug #1962464
Modified Paths:
--------------
trunk/pywikipedia/weblinkchecker.py
Modified: trunk/pywikipedia/weblinkchecker.py
===================================================================
--- trunk/pywikipedia/weblinkchecker.py 2008-05-12 12:57:09 UTC (rev 5356)
+++ trunk/pywikipedia/weblinkchecker.py 2008-05-12 16:17:13 UTC (rev 5357)
@@ -417,10 +417,20 @@
except httplib.error, error:
return False, u'HTTP Error: %s' % error.__class__.__name__
except socket.error, error:
- # TODO: decode error[1]. On Linux, it's encoded in UTF-8.
+ # http://docs.python.org/lib/module-socket.html :
+ # socket.error :
+ # The accompanying value is either a string telling what went
+ # wrong or a pair (errno, string) representing an error
+ # returned by a system call, similar to the value
+ # accompanying os.error
+ if isinstance(error, basestring):
+ msg = error
+ else:
+ msg = error[1]
+ # TODO: decode msg. On Linux, it's encoded in UTF-8.
# How is it encoded in Windows? Or can we somehow just
# get the English message?
- return False, u'Socket Error: %s' % repr(error[1])
+ return False, u'Socket Error: %s' % repr(msg)
if wasRedirected:
if self.url in self.redirectChain:
if useHEAD:
More information about the Pywikipedia-l
mailing list