Page MenuHomePhabricator

welcome.py: KeyError: 'registration' Exiting due to uncaught exception <class 'KeyError'>
Closed, ResolvedPublicBUG REPORT

Description

Background information:

  • This user exists on Arabic Wikiquote (arwikiquote) (registeration date: 8 June 2021), however the global account of the same user does not exist.
  • When the script welcome.py works on this user, it crashes.

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

python pwb.py welcome -edit:0 -sul -nlog -limit:5000 -site:wikiquote:ar

What happens?:

Script terminated by exception:

ERROR: KeyError: 'registration'
Traceback (most recent call last):
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 496, in <module>
    main()
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 480, in main
    if not execute():
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 463, in execute
    run_python_file(filename, script_args, module)
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 143, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\welcome.py", line 1017, in <module>
    main()
  File ".\scripts\welcome.py", line 1013, in main
    bot.run()
  File "C:\Users\Mohammed\Downloads\core\pywikibot\bot.py", line 1566, in run
    if self.skip_page(page):
  File ".\scripts\welcome.py", line 778, in skip_page
    if user.is_blocked() or user.is_locked():
  File "C:\Users\Mohammed\Downloads\core\pywikibot\page\_pages.py", line 2760, in is_locked
    return self.site.is_locked(self.username, force)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\site\_apisite.py", line 614, in is_locked
    return 'locked' in self.get_globaluserinfo(user, force)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\site\_apisite.py", line 560, in get_globaluserinfo
    ts = data['registration']
KeyError: 'registration'
CRITICAL: Exiting due to uncaught exception <class 'KeyError'>

What should have happened instead?:

  • The script should have skipped this user and continued working on other users normally.

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

Pywikibot: [https] r-pywikibot-core (568fe5e, g16265, 2022/04/03, 18:40:05, master)
Release version: 7.2.0.dev0
setuptools version: 61.3.1
mwparserfromhell version: 0.6.4
wikitextparser version: n/a
requests version: 2.27.1
    certificate test: ok
Python: 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]

Event Timeline

Xqt triaged this task as High priority.
Xqt removed a project: Pywikibot-Scripts.

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

[pywikibot/core@master] [bugfix] Take into account that global account may be missing

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

Meno25 removed a project: Patch-For-Review.

Change 777296 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Take into account that global account may be missing

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