Page MenuHomePhabricator

reflinks.py: UnicodeEncodeError
Closed, ResolvedPublic

Description

Error with reflinks.py on toollabs. The error line contain a mention to T69410.
This script have a big potential, I think that it can be good to maintain it. Thanks

tools.framabot@tools-bastion-02:~$ python /shared/pywikipedia/core/pwb.py reflinks -page:Jean-Marc_Ginoux -lang:fr
Retrieving 1 pages from wikipedia:fr.
Traceback (most recent call last):
  File "/shared/pywikipedia/core/pwb.py", line 263, in <module>
    if not main():
  File "/shared/pywikipedia/core/pwb.py", line 257, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "/shared/pywikipedia/core/pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File "/shared/pywikipedia/core/scripts/reflinks.py", line 797, in <module>
    main()
  File "/shared/pywikipedia/core/scripts/reflinks.py", line 793, in main
    bot.run()
  File "/shared/pywikipedia/core/scripts/reflinks.py", line 666, in run
    u = linkedpagetext.decode(enc[0])   # Bug T69410
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 143: ordinal not in range(128)
<type 'exceptions.UnicodeEncodeError'>
CRITICAL: Closing network session.
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2

Event Timeline

Change 371973 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [bugfix, i18n, PEP8] Make reflinks.py work smoothly

https://gerrit.wikimedia.org/r/371973

@Framawiki Do you have any idea which link caused this trouble?

Change 371973 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [bugfix, i18n, PEP8] Make reflinks.py work smoothly

https://gerrit.wikimedia.org/r/371973

Change 371973 merged by jenkins-bot:
[pywikibot/core@master] [bugfix, i18n, PEP8] Make reflinks.py work smoothly

https://gerrit.wikimedia.org/r/371973