korzhimanov created this task. korzhimanov added a subscriber: korzhimanov. korzhimanov added a project: pywikibot-compat. Restricted Application added subscribers: Aklapper, pywikipedia-bugs.
TASK DESCRIPTION After [[ https://github.com/wikimedia/pywikibot-core/commit/d064f91df8f1c45c7b0b5377c... | this commit ]] I have an issue with running pywikibot.data.api.Request() function containing unicode strings with non-ascii characters if 'site' property is not explicitly defined.
Say, this code
``` # -*- coding: utf-8 -*- import pywikibot
site = pywikibot.getSite('ru', 'wikipedia')
r = pywikibot.data.api.Request(action='purge', titles=u'Россия') ```
returns
``` Traceback (most recent call last): File "test.py", line 6, in <module> r = pywikibot.data.api.Request(action='purge', titles=u'Россия') File "/shared/pywikipedia/core/pywikibot/data/api.py", line 1108, in __init__ warn('Request() invoked without a site', RuntimeWarning, 2) File "/usr/lib/python2.7/logging/__init__.py", line 1713, in _showwarning logger.warning("%s", s) File "/usr/lib/python2.7/logging/__init__.py", line 1164, in warning self._log(WARNING, msg, args, **kwargs) File "/usr/lib/python2.7/logging/__init__.py", line 1271, in _log self.handle(record) File "/usr/lib/python2.7/logging/__init__.py", line 1281, in handle self.callHandlers(record) File "/usr/lib/python2.7/logging/__init__.py", line 1321, in callHandlers hdlr.handle(record) File "/usr/lib/python2.7/logging/__init__.py", line 749, in handle self.emit(record) File "/shared/pywikipedia/core/pywikibot/userinterfaces/terminal_interface_base.py", line 494, in emit ('warn(', 'exceptions.', 'Warning)', 'Warning,')) File "/shared/pywikipedia/core/pywikibot/userinterfaces/terminal_interface_base.py", line 493, in <genexpr> s in msg for s in UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 118: ordinal not in range(128) <type 'exceptions.UnicodeDecodeError'> ```
TASK DETAIL https://phabricator.wikimedia.org/T98955
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: korzhimanov Cc: pywikipedia-bugs, Aklapper, korzhimanov, Anshoe
XZise added a subscriber: XZise. XZise claimed this task. XZise added a comment.
Hmm seems that the message is `bytes` in Python 2.
TASK DETAIL https://phabricator.wikimedia.org/T98955
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: XZise Cc: XZise, Aklapper, korzhimanov, Anshoe, pywikipedia-bugs
XZise edited projects, added pywikibot-core; removed pywikibot-compat. XZise set Security to None.
TASK DETAIL https://phabricator.wikimedia.org/T98955
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: XZise Cc: XZise, Aklapper, korzhimanov, jayvdb, pywikipedia-bugs
gerritbot added a subscriber: gerritbot. gerritbot added a comment.
Change 210681 had a related patch set uploaded (by XZise): [FIX] TerminalHandler: Expect str in Python 2
https://gerrit.wikimedia.org/r/210681
TASK DETAIL https://phabricator.wikimedia.org/T98955
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: XZise, gerritbot Cc: gerritbot, XZise, Aklapper, korzhimanov, jayvdb, pywikipedia-bugs
gerritbot added a project: Patch-For-Review.
TASK DETAIL https://phabricator.wikimedia.org/T98955
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: XZise, gerritbot Cc: gerritbot, XZise, Aklapper, korzhimanov, jayvdb, pywikipedia-bugs
gerritbot added a comment.
Change 210681 merged by jenkins-bot: [FIX] TerminalHandler: Expect str in Python 2
https://gerrit.wikimedia.org/r/210681
TASK DETAIL https://phabricator.wikimedia.org/T98955
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: XZise, gerritbot Cc: gerritbot, XZise, Aklapper, korzhimanov, jayvdb, pywikipedia-bugs
pywikipedia-bugs@lists.wikimedia.org