Last modified: 2014-09-17 11:09:17 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1280/ Reported by: tgr_ Created on: 2011-01-09 09:33:39 Subject: Unicode error when handling non-ASCII network errors Original description: The error handler for Site.postData in wikipedia.py line 5248 \(in r8821\) casts an exception to a string: except Exception, e: output\(u'%s' %e\) This will fail with a UnicodeDecodeError if the exception message contains non-ASCII characters \(which is often the case for network error messages on non-English Windows\). Pywikipedia \[http\] trunk/pywikipedia \(r8821, 2011/01/06, 22:01:33\) Python 2.7 \(r27:82525, Jul 4 2010, 09:01:59\) \[MSC v.1500 32 bit \(Intel\)\] config-settings: use\_api = True use\_api\_login = True unicode test: triggers problem \#3081100
Can you reproduce the problem? If so, please change output\(u"%s" % e\) to output\(u"%r"% e\) and add a comment with the output you get. Additionally, please tell us what code page you are using \(run 'chcp' in a dos box\) and the language of your windows version. Thanks.
Hungarian Windows, codepage 852 %r gives URLError\(error\(10054, 'A l\xe9tez\xf5 kapcsolatot a t\xe1voli \xe1llom\xe1s k\xe9nyszer\xedtetten bez\xe1rta'\),\)