Last modified: 2013-12-20 21:30:40 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57131, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55131 - Non-unicode path results in UnicodeDecodeError
Non-unicode path results in UnicodeDecodeError
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
:
: 55230 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:29 UTC by Kunal Mehta (Legoktm)
Modified: 2013-12-20 21:30 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:29:36 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...
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:29:40 UTC
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
Comment 2 xqt 2013-12-17 12:02:36 UTC
*** Bug 55230 has been marked as a duplicate of this bug. ***
Comment 3 Mpaa 2013-12-20 21:30:40 UTC
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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links