https://bugzilla.wikimedia.org/show_bug.cgi?id=54235
Web browser: ---
Bug ID: 54235
Summary: Claim.fromJSON() fails on a deleted property
Product: Pywikibot
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: Wikidata
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Mobile Platform: ---
Today my bot encountered https://www.wikidata.org/wiki/Q3211336 . This contains
the deleted property P288.
This crashes the bot:
Traceback (most recent call last):
File "C:\pywikibot\core\article_to_category.py", line 97, in <module>
main()
File "C:\pywikibot\core\article_to_category.py", line 94, in main
bot.run()
File "C:\pywikibot\core\article_to_category.py", line 52, in run
if not u'P910' in itemB.get().get('claims').keys():
File "C:\pywikibot\core\pywikibot\page.py", line 2571, in get
c = Claim.fromJSON(self.repo, claim)
File "C:\pywikibot\core\pywikibot\page.py", line 2776, in fromJSON
if claim.getType() == 'wikibase-item':
File "C:\pywikibot\core\pywikibot\page.py", line 2715, in getType
self.type = self.repo.getPropertyType(self)
File "C:\pywikibot\core\pywikibot\site.py", line 3533, in getPropertyType
dtype = data['entities'][prop.getID().lower()]['datatype']
KeyError: u'p288'
If you look at
https://git.wikimedia.org/blob/pywikibot%2Fcore.git/a1d63c8ba608b87d3a3aff6acc8dbbc29085eb8f/pywikibot%2Fpage.py
from line 2776 and furthere, you'll see that it tries to lookup the type of the
property. That fails because the property is deleted.
I don't think the lookup is needed, see
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q3211336&format=json
:
"P288": [
{
"id": "q3211336$00f2cba0-4c06-ee8d-9598-d8c034b663ed",
"mainsnak": {
"snaktype": "value",
"property": "P288",
"datavalue": {
"value": {
"entity-type": "item",
"numeric-id": 2304194
},
"type": "wikibase-entityid"
}
},
"type": "statement",
"rank": "normal"
}
]
This should be used to construct the claim instead of the extra lookup
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l