Page MenuHomePhabricator

reflinks.py: unknown encoding: ru-win1251
Closed, ResolvedPublicBUG REPORT

Description

What happens?:

Script terminated by exception:

ERROR: unknown encoding: ru-win1251 (LookupError)
Traceback (most recent call last):
  File "/data/project/rubin16/pywikibot-core/pwb.py", line 487, in <module>
    main()
  File "/data/project/rubin16/pywikibot-core/pwb.py", line 471, in main
    if not execute():
  File "/data/project/rubin16/pywikibot-core/pwb.py", line 454, 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 794, in <module>
    main()
  File "/data/project/rubin16/pywikibot-core/scripts/reflinks.py", line 790, in main
    bot.run()
  File "/mnt/nfs/labstore-secondary-tools-project/rubin16/pywikibot-core/pywikibot/bot.py", line 1624, in run
    self.treat(page)
  File "/data/project/rubin16/pywikibot-core/scripts/reflinks.py", line 659, in treat
    tag = meta_content.group().decode(enc)
LookupError: unknown encoding: ru-win1251
Dropped throttle(s).
Closing network session.
CRITICAL: Exiting due to uncaught exception <class 'LookupError'>

What should have happened instead?:
Script shouldn't crash.

Event Timeline

What was the page the bot worked when crashed?

Xqt triaged this task as High priority.May 6 2022, 8:13 AM

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

[pywikibot/core@master] [bugfix] Improve get_charset_from_content_type function

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

What was the page the bot worked when crashed?

took some time to find it, seems to be this one:
https://ru.wikipedia.org/wiki/Большаков,_Борис_Евгеньевич

What was the page the bot worked when crashed?

took some time to find it, seems to be this one:
https://ru.wikipedia.org/wiki/Большаков,_Борис_Евгеньевич

Thanks a lot. My patch works then.

Xqt claimed this task.

Change 789774 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Improve get_charset_from_content_type function

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