Last modified: 2014-09-09 07:22:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57125, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55125 - Harvest_template.py aborts when the value is empty
Harvest_template.py aborts when the value is empty
Status: NEW
Product: Pywikibot
Classification: Unclassified
Wikidata (Other open bugs)
compat-(1.0)
All All
: Unprioritized normal
: ---
Assigned To: John Mark Vandenberg
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:28 UTC by Kunal Mehta (Legoktm)
Modified: 2014-09-09 07:22 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:28:49 UTC
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.
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:28:52 UTC
- **Group**: confirmed --> rewrite
Comment 2 John Mark Vandenberg 2014-05-25 14:35:43 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links