Page MenuHomePhabricator

Pywikibot: welcome.py crashes with HiddenKeyError
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:

Run this welcome.py command on a wiki where there is a hidden username in the username log (e.g. ar.wikiquote).

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

Expected Results:

The bot should skip users whose usernames are hidden and continue working on other users

Actual Results:

The bot crashes with HiddenKeyError (because the username of the account with User ID 23292 was hidden) and you have to restart the bot run again.

Traceback (most recent call last):
  File "pwb.py", line 250, in <module>
    if not main():
  File "pwb.py", line 243, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "pwb.py", line 95, in run_python_file
    main_mod.__dict__)
  File "./scripts/welcome.py", line 1027, in <module>
    main()
  File "./scripts/welcome.py", line 1010, in main
    bot.run()
  File "./scripts/welcome.py", line 774, in run
    for users in self.parseNewUserLog():
  File "./scripts/welcome.py", line 726, in parseNewUserLog
    yield ue.page()
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/logentries.py", line 177, in page
    self._page = pywikibot.User(self.site, self.data['title'])
  File "/mnt/nfs/labstore-secondary-tools-home/meno25/core/pywikibot/logentries.py", line 38, in __missing__
    'permission to view it.'.format(self._type, key))
pywikibot.exceptions.HiddenKeyError: Log entry (newusers) has a hidden 'title' key and you don't have permission to view it.
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.HiddenKeyError'>

Event Timeline

Xqt triaged this task as Medium priority.Apr 29 2019, 6:31 PM

Change 507236 had a related patch set uploaded (by JJMC89; owner: JJMC89):
[pywikibot/core@master] [FIX] Skip hidden users

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

Xqt changed the subtype of this task from "Task" to "Bug Report".Apr 30 2019, 4:17 AM
Xqt subscribed.

Thanks @JJMC89 for solving and Meno25 for reporting this bug

Change 507236 merged by jenkins-bot:
[pywikibot/core@master] [FIX] Skip hidden users

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