Page MenuHomePhabricator

Skip InvalidPageError in cosmetic_changes.py
Closed, ResolvedPublic

Description

Command line:

python pwb.py cosmetic_changes -page:"ويكيبيديا:Category handler" -lang:arz

Output:

>>> ويكيبيديا:Category handler <<<

0 pages read
0 pages written
0 pages skipped
Execution time: 1 seconds
Script terminated by exception:

ERROR: InvalidPageError: Page [[arz:ويكيبيديا:Category handler]] is invalid.
Traceback (most recent call last):
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 423, in <module>
    if not main():
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 415, in main
    run_python_file(filename,
  File "C:\Users\Mohammed\Downloads\core\pwb.py", line 112, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\cosmetic_changes.py", line 125, in <module>
    main()
  File ".\scripts\cosmetic_changes.py", line 121, in main
    bot.run()
  File "C:\Users\Mohammed\Downloads\core\pywikibot\bot.py", line 1585, in run
    self.treat(page)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\bot.py", line 1840, in treat
    self.treat_page()
  File ".\scripts\cosmetic_changes.py", line 78, in treat_page
    changed_text = cc_toolkit.change(self.current_page.text)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\page\__init__.py", line 569, in text
    return self.get(get_redirect=True)
  File "C:\Users\Mohammed\Downloads\core\pywikibot\page\__init__.py", line 441, in get
    return self.latest_revision.text
  File "C:\Users\Mohammed\Downloads\core\pywikibot\page\__init__.py", line 556, in latest_revision
    raise InvalidPageError(self)
pywikibot.exceptions.InvalidPageError: Page [[arz:ويكيبيديا:Category handler]] is invalid.
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.InvalidPageError'>

Output of version.py:

Pywikibot: [https] r-pywikibot-core (aa50035, g15513, 2021/10/17, 15:57:50, master)
Release version: 7.0.0.dev0
setuptools version: 58.2.0
mwparserfromhell version: 0.6.3
wikitextparser version: n/a
requests version: 2.26.0
    certificate test: ok
Python: 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)]

Request:

Please make the bot skip such pages (i.e. not break the bot run) when it encounters such pages. Thank you.

Notes:

Details

Event Timeline

Xqt triaged this task as Medium priority.

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

[pywikibot/core@master] FEAT] skip InvalidPageError in cosmetic_changes.py

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

Change 735929 merged by jenkins-bot:

[pywikibot/core@master] FEAT] skip InvalidPageError in cosmetic_changes.py

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

Meno25 removed a project: Patch-For-Review.