Page MenuHomePhabricator

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


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

ERROR: KeyError: 'restrictions'
Traceback (most recent call last):
  File ".\", line 378, in <module>
    if not main():
  File ".\", line 370, in main
  File ".\", line 105, in run_python_file
    exec(compile(source, filename, 'exec', dont_inherit=True),
  File ".\scripts\", line 1170, in <module>
  File ".\scripts\", line 1162, in main
  File "C:\core\pywikibot\", line 1405, in run
  File ".\scripts\", line 727, in treat
    if not page.has_permission():
  File "C:\core\pywikibot\page\", line 1159, in has_permission
    return, action)
  File "C:\core\pywikibot\site\", line 3177, in page_can_be_edited
    if action not in self.siteinfo['restrictions']['types']:
  File "C:\core\pywikibot\site\", line 1640, in __getitem__
    return self.get(key, False)  # caches and doesn't force it
  File "C:\core\pywikibot\site\", 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 .\ 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

Event Timeline

JJMC89 changed the subtype of this task from "Task" to "Bug Report".
JJMC89 removed a project:

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

Xqt triaged this task as High priority.Jun 6 2020, 9:15 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)

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