Page MenuHomePhabricator

terminate welcome script gracefully if script is not localized
Closed, ResolvedPublicFeature

Description

py -3.13 -m pwb -site:wikidata -simulate welcome leads to

[Match] Dasldal has enough edits to be welcomed.
[Warn ] wikidata:wikidata doesn't allow random signature, force disable.

1 read operation
Execution time: 2 seconds
Read operation time: 2.0 seconds
Script terminated by exception:

ERROR: 'welcome.py is not localized for site wikidata:wikidata in WELCOME dict.' (KeyError)
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\pwb\GIT\core\pwb.py", line 40, in <module>
    sys.exit(main())
             ~~~~^^
  File "C:\pwb\GIT\core\pwb.py", line 36, in main
    runpy.run_path(str(path), run_name='__main__')
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 287, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "C:\pwb\GIT\core\pywikibot\scripts\wrapper.py", line 566, in <module>
    main()
    ~~~~^^
  File "C:\pwb\GIT\core\pywikibot\scripts\wrapper.py", line 550, in main
    if not execute():
           ~~~~~~~^^
  File "C:\pwb\GIT\core\pywikibot\scripts\wrapper.py", line 537, in execute
    run_python_file(filename, script_args, module)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\pwb\GIT\core\pywikibot\scripts\wrapper.py", line 154, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         main_mod.__dict__)
         ^^^^^^^^^^^^^^^^^^
  File "C:\pwb\GIT\core\scripts\welcome.py", line 1053, in <module>
    main()
    ~~~~^^
  File "C:\pwb\GIT\core\scripts\welcome.py", line 1049, in main
    bot.run()
    ~~~~~~~^^
  File "C:\pwb\GIT\core\pywikibot\bot.py", line 1593, in run
    self.treat(page)
    ~~~~~~~~~~^^^^^^
  File "C:\pwb\GIT\core\scripts\welcome.py", line 873, in treat
    welcome_text = get_welcome_text(self.site,
                                    sign=choice(signs) if signs else '')
  File "C:\pwb\GIT\core\scripts\welcome.py", line 513, in get_welcome_text
    raise KeyError(f'{script}.py is not localized for site {site} in '
                   f'{welcome}WELCOME dict.')
KeyError: 'welcome.py is not localized for site wikidata:wikidata in WELCOME dict.'
CRITICAL: Exiting due to uncaught exception KeyError: 'welcome.py is not localized for site wikidata:wikidata in WELCOME dict.'

C:\pwb\GIT\core>

The new behaviour was introduced by rPWBC376771363

Event Timeline

Xqt triaged this task as Medium priority.Jan 7 2026, 5:33 PM
Xqt changed the subtype of this task from "Task" to "Feature Request".
Xqt updated the task description. (Show Details)
Xqt added a project: Regression.
Xqt raised the priority of this task from Medium to High.Jan 7 2026, 5:38 PM
Xqt changed the task status from Open to In Progress.Jan 10 2026, 9:18 AM
Xqt claimed this task.

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

[pywikibot/core@master] welcome: Check whether the script is localized within WelcomeBot initializer

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

Change #1225071 merged by jenkins-bot:

[pywikibot/core@master] welcome: Check whether the script is localized within WelcomeBot initializer

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