Page MenuHomePhabricator

reflinks.py: LookupError: unknown encoding: cp-1251
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • while running reflinks.py it crashes due to invalid encoding, I was running something like
venv/bin/python3 $HOME/pywikibot-core/pwb.py reflinks -start:Таужное -v -debug

What happens?:

WARNING: Unknown or invalid encoding 'cp-1251'
Dropped throttle(s).
Script terminated by exception:

ERROR: LookupError: unknown encoding: cp-1251
Traceback (most recent call last):
  File "/data/project/rubin16/pywikibot-core/pwb.py", line 496, in <module>
    main()
  File "/data/project/rubin16/pywikibot-core/pwb.py", line 480, in main
    if not execute():
  File "/data/project/rubin16/pywikibot-core/pwb.py", line 463, in execute
    run_python_file(filename, script_args, module)
  File "/data/project/rubin16/pywikibot-core/pwb.py", line 144, in run_python_file
    main_mod.__dict__)
  File "/data/project/rubin16/pywikibot-core/scripts/reflinks.py", line 824, in <module>
    main()
  File "/data/project/rubin16/pywikibot-core/scripts/reflinks.py", line 820, in main
    bot.run()
  File "/mnt/nfs/labstore-secondary-tools-project/rubin16/pywikibot-core/pywikibot/bot.py", line 1571, in run
    self.treat(page)
  File "/data/project/rubin16/pywikibot-core/scripts/reflinks.py", line 686, in treat
    tag = meta_content.group().decode(enc)
LookupError: unknown encoding: cp-1251
Dropped throttle(s).
Closing network session.
CRITICAL: Exiting due to uncaught exception <class 'LookupError'>
Network session closed.

What should have happened instead?:

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

Event Timeline

Xqt triaged this task as Medium priority.

Change 774862 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] Fix cp encodings in reflinks.py

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

Change 774862 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Fix cp encodings in reflinks.py

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