Page MenuHomePhabricator

Various error message for the same problem?
Closed, InvalidPublic

Description

When I start pwb.py redirect broken -lang:ar I get distingued error messages:

>>> 11 فبراير <<<
Traceback (most recent call last):
  File "C:\pwb\GIT\core\pwb.py", line 256, in <module>
    if not main():
  File "C:\pwb\GIT\core\pwb.py", line 250, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\pwb\GIT\core\pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File ".\scripts\redirect.py", line 816, in <module>
    main()
  File ".\scripts\redirect.py", line 813, in main
    bot.run()
  File ".\scripts\redirect.py", line 714, in run
    self.delete_broken_redirects()
  File ".\scripts\redirect.py", line 402, in delete_broken_redirects
    self.delete_1_broken_redirect(redir_name)
  File ".\scripts\redirect.py", line 416, in delete_1_broken_redirect
    targetPage = redir_page.getRedirectTarget()
  File "C:\pwb\GIT\core\pywikibot\page.py", line 1545, in getRedirectTarget
    return self.site.getredirtarget(self)
  File "C:\pwb\GIT\core\pywikibot\site.py", line 3022, in getredirtarget
    % title.encode(self.encoding()))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd9 in position 3: ordinal
not in range(128)
<type 'exceptions.UnicodeDecodeError'>
CRITICAL: Closing network session.
C:\pwb\GIT\core>pwb.py version
Pywikibot: [ssh] pywikibot-core (8d60418, g7146, 2016/03/22, 16:42:59, ok)
Release version: 3.0-dev
requests version: 2.7.0
  cacerts: C:\Python27\lib\site-packages\requests\cacert.pem
    certificate test: ok
Python: 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)]
PYWIKIBOT2_DIR: Not set
PYWIKIBOT2_DIR_PWB: C:\pwb\GIT\core
PYWIKIBOT2_NO_USER_CONFIG: Not set
Config base dir: C:\pwb\GIT\core

>>> 11 فبراير <<<
Traceback (most recent call last):
  File "C:\pwb\core\pwb.py", line 256, in <module>
    if not main():
  File "C:\pwb\core\pwb.py", line 250, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\pwb\core\pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File ".\scripts\redirect.py", line 914, in <module>
    main()
  File ".\scripts\redirect.py", line 911, in main
    bot.run()
  File ".\scripts\redirect.py", line 772, in run
    self.delete_broken_redirects()
  File ".\scripts\redirect.py", line 460, in delete_broken_redirects
    self.delete_1_broken_redirect(redir_name)
  File ".\scripts\redirect.py", line 474, in delete_1_broken_redirect
    targetPage = redir_page.getRedirectTarget()
  File "C:\pwb\core\pywikibot\page.py", line 1545, in getRedirectTarget
    return self.site.getredirtarget(self)
  File "C:\pwb\core\pywikibot\site.py", line 3022, in getredirtarget
    % title.encode(self.encoding()))
RuntimeError: getredirtarget: No 'redirects' found for page '11 \xd9\x81\xd8\xa8
\xd8\xb1\xd8\xa7\xd9\x8a\xd8\xb1'.
<type 'exceptions.RuntimeError'>
CRITICAL: Closing network session.
C:\pwb\core>pwb.py version
Pywikibot: pywikibot-core (8d60418, s8375, 2016/03/24, 09:21:53, ok)
Release version: 3.0-dev
requests version: 2.7.0
  cacerts: C:\Python27\lib\site-packages\requests\cacert.pem
    certificate test: ok
Python: 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)]
PYWIKIBOT2_DIR: Not set
PYWIKIBOT2_DIR_PWB: C:\pwb\core
PYWIKIBOT2_NO_USER_CONFIG: Not set
Config base dir: C:\pwb\core

Event Timeline

Xqt created this task.Mar 25 2016, 7:13 AM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptMar 25 2016, 7:13 AM
Xqt added a comment.EditedMar 25 2016, 7:16 AM

The environment with unicodeDecodeError has config.console_encoding = 'cp850' but deactivating this line doesn't give me the other message.

Xqt closed this task as Invalid.EditedMar 25 2016, 9:54 AM

In my other repo the exception string uses repr instead of string which solves the UnicodeDecodeError here:

raise RuntimeError("getredirtarget: No 'redirects' found for page %r." % title.encode(self.encoding()))

but this might be another bug