Last modified: 2013-12-20 21:30:40 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1648/ Reported by: valhallasw Created on: 2013-07-28 19:36:57.919000 Subject: Non-unicode path results in UnicodeDecodeError Original description: From an IRC support request: Traceback (most recent call last): File "login.py", line 436, in <module> main() File "login.py", line 432, in main loginMan.login() File "login.py", line 319, in login cookiedata = self.getCookie(api) File "login.py", line 243, in getCookie self.site.updateCookies(L, self.sysop) File "wikipedia.py", line 6371, in updateCookies self._setupCookies(self._cookies[index], sysop) File "wikipedia.py", line 6342, in _setupCookies f = open(config.datafilepath('login-data', filename), 'w') File "config.py", line 555, in datafilepath return makepath(os.path.join(base_dir, *filename)) File "/usr/lib/python2.7/posixpath.py", line 80, in join path += '/' + b UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 16: ordinal not in range(128) The pywikipedia folder was in '/.../Télechargements', which is has an accented letter. Moving to a non-accented directory solved the issue. User is running rewrite; version.py did not yield useful results because it doesn't support git or git nightlies yet...
in config.datafilepath(*filename), os.path.join(base_dir, *filename) fails if: -. at least one of the argument of os.path.join() is unicode and -. at least one of the argument of os.path.join() has non-ASCII char
*** Bug 55230 has been marked as a duplicate of this bug. ***
Solved by https://gerrit.wikimedia.org/r/#/c/85029/ Use unicode base path; fixes https://sourceforge.net/p/pywikipediabot/bugs/1648/ execfile does not accept unicode paths, so a manual exec open(...).read() will have to take its job. Change-Id: I9741c9f97e5a66f0d1af012a82f933f493c64066