Page MenuHomePhabricator

logentries.py fails on call to user()
Closed, InvalidPublic

Description

While reading logentry via le.user() (le is an logentry type object) it fails with the error KeyError: u"Log entry (delete) has no 'user' key"

ms-deletestats.py script analyses logentries for deletion actions

masti@tools ~/pw/core $ time python pwb.py masti/ms-deletestats.py -page:'!' -outpage:'deletes.html'
Traceback (most recent call last):

File "pwb.py", line 262, in <module>
  if not main():
File "pwb.py", line 255, in main
  run_python_file(filename, [filename] + args, argvu, file_package)
File "pwb.py", line 121, in run_python_file
  main_mod.__dict__)
File "./masti/ms-deletestats.py", line 443, in <module>
  main()
File "./masti/ms-deletestats.py", line 436, in main
  bot.run()  # guess what it does
File "./masti/ms-deletestats.py", line 148, in run
  deletereasons = self.deleteReasons(currtime,int(self.getOption('days')))
File "./masti/ms-deletestats.py", line 172, in deleteReasons
  pywikibot.output(u'%i>>%s>>%s>>%s>>%s>>%s>>%s' % (count, le.type(), le.logid(),le.timestamp(),le.action(),le.user(),comment))
File "/home/mst/pw/core/pywikibot/logentries.py", line 139, in user
  return self.data['user']
File "/home/mst/pw/core/pywikibot/logentries.py", line 37, in __missing__
  raise KeyError("Log entry (%s) has no '%s' key" % (self._type, key))

KeyError: u"Log entry (delete) has no 'user' key"
<type 'exceptions.KeyError'>
CRITICAL: Closing network session.
python pwb.py version.py
Pywikibot: [https] r-pywikibot-core (22d19cf, g8626, 2017/09/12, 13:50:19, n/a)
Release version: 3.0-dev
requests version: 2.12.5

cacerts: /etc/ssl/certs/ca-certificates.crt
  certificate test: ok

Python: 2.7.12 (default, Apr 24 2017, 01:43:29)
[GCC 4.9.3]
PYWIKIBOT2_DIR: Not set
PYWIKIBOT2_DIR_PWB:
PYWIKIBOT2_NO_USER_CONFIG: Not set
Config base dir: /usr/home/masti/pw/core
Usernames for family "wikipedia":

Event Timeline

I have found the real reason for the error which was a not catched wrong entry in the delete log.
That makes the task invalid