Revision: 7656 Author: xqt Date: 2009-11-16 10:48:26 +0000 (Mon, 16 Nov 2009)
Log Message: ----------- decoding unicode; Bugfix for #2885545
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-11-16 05:51:41 UTC (rev 7655) +++ trunk/pywikipedia/wikipedia.py 2009-11-16 10:48:26 UTC (rev 7656) @@ -3654,9 +3654,11 @@ data = self.getData() except (socket.error, httplib.BadStatusLine, ServerError): # Print the traceback of the caught exception - output(u''.join(traceback.format_exception(*sys.exc_info()))) - output(u'DBG> got network error in _GetAll.run. ' \ - 'Sleeping for %d seconds...' % self.sleeptime) + s = ''.join(traceback.format_exception(*sys.exc_info())) + if not isinstance(s, unicode): + s = s.decode('utf-8') + output(u'%s\nDBG> got network error in _GetAll.run. ' \ + 'Sleeping for %d seconds...' % (s, self.sleeptime)) self.sleep() else: if "<title>Wiki does not exist</title>" in data: