Page MenuHomePhabricator

KeyError: 'restrictions' trying to use text replace function of replace.py
Closed, ResolvedPublicBUG REPORT

Description

I´m getting the followed exception trying to use a text replace function of replace.py

ERROR: KeyError: 'restrictions'
Traceback (most recent call last):
  File ".\pwb.py", line 378, in <module>
    if not main():
  File ".\pwb.py", line 370, in main
    run_python_file(filename,
  File ".\pwb.py", line 105, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\replace.py", line 1170, in <module>
    main()
  File ".\scripts\replace.py", line 1162, in main
    bot.run()
  File "C:\core\pywikibot\bot.py", line 1405, in run
    self.treat(page)
  File ".\scripts\replace.py", line 727, in treat
    if not page.has_permission():
  File "C:\core\pywikibot\page\__init__.py", line 1159, in has_permission
    return self.site.page_can_be_edited(self, action)
  File "C:\core\pywikibot\site\__init__.py", line 3177, in page_can_be_edited
    if action not in self.siteinfo['restrictions']['types']:
  File "C:\core\pywikibot\site\__init__.py", line 1640, in __getitem__
    return self.get(key, False)  # caches and doesn't force it
  File "C:\core\pywikibot\site\__init__.py", line 1688, in get
    raise KeyError(key)
KeyError: 'restrictions'
CRITICAL: Exiting due to uncaught exception <class 'KeyError'>

The line I´m running is like this:

python.exe .\pwb.py replace -page:"Pagename" "Woord" "Word"

The bot is logged into a FANDOM (Wikia) site running on MediaWiki 1.19.24. The bot works without any problem for delete.py.

Event Timeline

Nodita created this task.Jun 5 2020, 7:46 PM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptJun 5 2020, 7:46 PM
JJMC89 claimed this task.Jun 5 2020, 8:34 PM
JJMC89 changed the subtype of this task from "Task" to "Bug Report".
JJMC89 removed a project: Pywikibot-replace.py.

Change 602768 had a related patch set uploaded (by JJMC89; owner: JJMC89):
[pywikibot/core@master] [BUGFIX] Use get in page_can_be_edited

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

Xqt triaged this task as High priority.Jun 6 2020, 9:15 AM
Dvorapa added a subscriber: Dvorapa.EditedJun 6 2020, 10:30 AM

Yeah, an old issue, you can find more MW 1.19 issues in MW 1.19 tests. Also there is an issue with editmywatchlist right and gsrsearch (also shown in Fandom wiki tests)

Xqt closed this task as Resolved.Jun 7 2020, 11:47 AM

Change 602768 merged by jenkins-bot:
[pywikibot/core@master] [BUGFIX] Use get in page_can_be_edited

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