Page MenuHomePhabricator

fixing_redirects.py fails for RuntimeError
Closed, ResolvedPublic

Description

Command line:

python3 pwb.py fixing_redirects -lang:ar -family:wikiversity -start:Template:!

Output:

ERROR: RuntimeError: getredirtarget: No 'redirects' found for page موضوع:علم المواد.
Traceback (most recent call last):
  File "pwb.py", line 363, in <module>
    if not main():
  File "pwb.py", line 358, in main
    file_package)
  File "pwb.py", line 75, in run_python_file
    main_mod.__dict__)
  File "./scripts/fixing_redirects.py", line 223, in <module>
    main()
  File "./scripts/fixing_redirects.py", line 217, in main
    bot.run()
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/bot.py", line 1487, in run
    self.treat(page)
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/bot.py", line 1766, in treat
    self.treat_page()
  File "./scripts/fixing_redirects.py", line 147, in treat_page
    target = page.getRedirectTarget()
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/page/__init__.py", line 1646, in getRedirectTarget
    return self.site.getredirtarget(self)
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/site/__init__.py", line 2494, in getredirtarget
    .format(title))
RuntimeError: getredirtarget: No 'redirects' found for page موضوع:علم المواد.
CRITICAL: Exiting due to uncaught exception <class 'RuntimeError'>

Problem:

  • When running the script fixing_redirects.py, the bot crashes when encountering the above error.
  • This is annoying as I have to manually restart the bot again.

Notes:

rPWBC9bdddaa7be5d818aa54dd45a68861151e63ba172

Request:

Please implement the same fix for fixing_redirects.py (i.e. make the bot skip the page in this case instead of crashing). Thank you.

Event Timeline

Meno25 created this task.Nov 9 2020, 3:26 PM
Restricted Application added subscribers: pywikibot-bugs-list, alaa, Aklapper. · View Herald TranscriptNov 9 2020, 3:26 PM

Change 640327 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [IMPR] Ignore RuntimeError for missing 'redirects' in api response

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

Xqt claimed this task.Nov 10 2020, 8:41 AM
Xqt triaged this task as Low priority.

The RuntimeError due to missing 'redirects' entry in api Response can only passed on Pywikibot side but the underlying database could be corrupted and must be solved upstream.

Xqt lowered the priority of this task from Low to Lowest.Nov 10 2020, 10:15 AM

Solved on Pywikibot side.

Change 640327 merged by jenkins-bot:
[pywikibot/core@master] [IMPR] Ignore RuntimeError for missing 'redirects' in api response

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

Meno25 closed this task as Resolved.Nov 10 2020, 6:10 PM