Page MenuHomePhabricator

Wikibase operations fail when -simulate enabled
Closed, ResolvedPublicBUG REPORT


Similar errors occur in addClaim, addSource, etc .. but here is the backtrace for editEntity updating an item.

Welcome to the Pywikibot interactive shell!
>>> import pywikibot
>>> datasite ='test', 'wikidata', None, None)
>>> item =, 'Q68')
>>> item.get()
Found 4 wikidata:test processes running, including this one.
{'claims': {u'P115': [< instance at 0xb611b5ac>]}, 'labels': {u'en': u'Test123'}, 'sitelinks': {}, 'descriptions': {}, 'aliases': {u'en': [u'1417625792.03']}}
>>> item.editEntity(data=item.toJSON())
Logging in to wikidata:test as JVbot
Should be logged in now
SIMULATION: wbeditentity action blocked.
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File ".../pywikibot/", line 3035, in editEntity
    self.lastrevid = updates['entity']['lastrevid']
KeyError: 'entity'

Event Timeline

jayvdb raised the priority of this task from to Needs Triage.
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot-Wikidata.
jayvdb changed Security from none to None.
jayvdb subscribed.
Xqt triaged this task as High priority.Nov 6 2018, 6:56 AM
Xqt changed the subtype of this task from "Task" to "Bug Report".Jun 24 2020, 11:52 AM
Xqt added a subscriber: matej_suchanek.

Update traceback as follows:

>>> import pwb, pywikibot
>>> datasite ='test', 'wikidata', None)
>>> item =, 'Q68')
>>> item.get()
{'labels': < object at 0x00000185034F6FD0>, 'descriptions': < object at 0x00000185034F6F70>, 'aliases': < object at 0x00000185034F6F10>, 'claims': < object at 0x00000185034F6E80>, 'sitelinks': < object at 0x00000185034F6EB0>}
>>> pywikibot.config.simulate = False
>>> item.editEntity(data=item.toJSON())
Password for user Xqbot on wikidata:test (no characters will be shown): WARNING: C:\Python38\lib\ GetPassWarning: Can not control echo on the terminal.
  return fallback_getpass(prompt, stream)

Warning: Password input may be echoed.
Logging in to wikidata:test as Xqbot
>>> item.editEntity(data=item.toJSON())  ## no change is made with simulate=False
Sleeping for 18.8 seconds, 2020-06-24 13:48:21
>>> pywikibot.config.simulate = True
>>> item.editEntity(data=item.toJSON())
SIMULATION: wbeditentity action blocked. ***
Traceback (most recent call last):
  File "<pyshell#44>", line 1, in <module>
  File "C:\pwb\GIT\core\pywikibot\page\", line 136, in wrapper
    handle(func, self, *args, **kwargs)
  File "C:\pwb\GIT\core\pywikibot\page\", line 115, in handle
    func(self, *args, **kwargs)
  File "C:\pwb\GIT\core\pywikibot\page\", line 4547, in editEntity
    super(WikibasePage, self).editEntity(
  File "C:\pwb\GIT\core\pywikibot\page\", line 4271, in editEntity
    self._content = updates['entity']
KeyError: 'entity'

Curiously no change is made with pywikibot.config.simulate = False

Change 697445 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [tests] Expand simulate query response

Xqt claimed this task.

Change 697445 merged by jenkins-bot:

[pywikibot/core@master] [tests] Expand simulate query response