Page MenuHomePhabricator

Harvest_template.py aborts when the value is empty
Closed, DeclinedPublic

Description

Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1663/
Reported by: gerardm
Created on: 2013-08-30 08:03:50.007000
Subject: Harvest_template.py aborts when the value is empty
Original description:
When a template has no value (null) the bot should not abort but preferably write to an error log for later processing.


Version: compat-(1.0)
Severity: normal
See Also:
https://sourceforge.net/p/pywikipediabot/bugs/1663

Details

Reference
bz55125

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:21 AM
bzimport set Reference to bz55125.
  • Group: confirmed --> rewrite

This is still happening in core(rewrite) too.
The backtrace looks like

Adding Pxx --> None
ERROR: AttributeError: 'NoneType' object has no attribute 'getID'
Traceback (most recent call last):

File "scripts/harvest_template.py", line 66, in run
  self.processPage(page)
File "scripts/harvest_template.py", line 161, in processPage
  item.addClaim(claim)
File "...pywikibot/page.py", line 2744, in addClaim
  self.repo.addClaim(self, claim, bot=bot, **kwargs)
File "...pywikibot/site.py", line 570, in callee
  return fn(self, *args, **kwargs)
File "...pywikibot/site.py", line 3714, in addClaim
  params['value'] = json.dumps(claim._formatDataValue())
File "...pywikibot/page.py", line 3056, in _formatDataValue
  'numeric-id': self.getTarget().getID(numeric=True)}

AttributeError: 'NoneType' object has no attribute 'getID'

https://git.wikimedia.org/commit/pywikibot%2Fcore.git/3183452cd1dfaf354c5de4afbd3d9d8e5cf31979 fixed the problem with:

if not field or not value:
    continue

The compat harvest code needs a lot of work before it is usable for testing even, so I am not going to try to backport this just yet. Assigning to myself to work on soonish.

Aklapper triaged this task as Lowest priority.Jun 5 2015, 1:41 PM
Aklapper subscribed.

Pywikibot has two versions: Compat and Core. This task was filed about the older version, called Pywikibot-compat, which is not under active development anymore. Hence I'm lowering the priority of this task to reflect the reality. Unfortunately, the Pywikibot team does not have the manpower to retest every single bug report / feature request against the (maintained) Pywikibot code base. Furthermore, the code base of Pywikibot-Compat has changed a lot compared to the code base of Pywikibot-Core so there is a chance that the problem described in this task might not exist anymore. Please help: Unfortunately manpower is limited and does not allow testing every single reported task again. If you have time and interest in Pywikibot, please upgrade to Pywikibot-Core and add a comment to this task if the problem in this task still happens in Pywikibot-Core (or directly edit the task by removing the Pywikibot-compat project and adding the Pywikibot project to this task). To learn more about Pywikibot and to get involved in its development, please check out https://www.mediawiki.org/wiki/Manual:Pywikibot/Development Thank you for your understanding.

Xqt subscribed.

Use core instead