Page MenuHomePhabricator

Commonscat.py crashes when processing a page that is connected to a redirected Wikidata item
Closed, ResolvedPublicBUG REPORT

Description

Command line:

python3 pwb.py commonscat -lang:ary -start:!

Output:

Script terminated by exception:

ERROR: IsRedirectPage: Page [[wikidata:Q27538657]] is a redirect 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/commonscat.py", line 557, in <module>
    main()
  File "./scripts/commonscat.py", line 551, in main
    bot.run()
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/bot.py", line 1498, in run
    self.treat(page)
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/bot.py", line 1777, in treat
    self.treat_page()
  File "./scripts/commonscat.py", line 312, in treat_page
    commonscatLink = self.find_commons_category(page)
  File "./scripts/commonscat.py", line 406, in find_commons_category
    claim = page.get_best_claim(cat_property)
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/page/__init__.py", line 2383, in get_best_claim
    item_page.get()
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/page/__init__.py", line 4597, in get
    raise pywikibot.IsRedirectPage(self)
pywikibot.exceptions.IsRedirectPage: Page [[wikidata:Q27538657]] is a redirect page.
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.IsRedirectPage'>

Description of problem:

  • When commonscat.py runs on an article that is connected to a redirected Wikidata item (ary:آيت عمار that was connected to Q27538657), it crashes.

Request:

  • Please make the script skip the page in such cases (but not crash).

Workaround:

  • I have manually cleared the cache of the article on arywiki (by making a null edit) and this solved the problem.

Event Timeline

Meno25 created this task.Oct 18 2020, 8:16 PM
Restricted Application added subscribers: pywikibot-bugs-list, alaa, Aklapper. · View Herald TranscriptOct 18 2020, 8:16 PM
Meno25 updated the task description. (Show Details)Oct 18 2020, 10:05 PM
Xqt triaged this task as Medium priority.Oct 19 2020, 3:41 AM
Xqt changed the subtype of this task from "Task" to "Bug Report".

Change 637717 had a related patch set uploaded (by Mpaa; owner: Mpaa):
[pywikibot/core@master] [bugfix] do not raise Exception in Page.get_best_claim()

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

Change 637717 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] do not raise Exception in Page.get_best_claim()

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

Xqt closed this task as Resolved.Oct 30 2020, 5:10 PM
Xqt claimed this task.