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