albertvillanova / WikidataBot

Wikidata bot
http://www.wikidata.org/wiki/User:AVMbot
0 stars 0 forks source link

[scripts] transfer_infotable crashes with APIError #49

Closed albertvillanova closed 4 years ago

albertvillanova commented 4 years ago

wikipedia:ca:Joaquín María Borrás

2020-03-16 18:44:57,768 [    INFO] Parse position qualifier: inici: [[22 d’abril]] de [[1852]]
2020-03-16 18:44:57,769 [    INFO] Parse date
2020-03-16 18:44:57,769 [    INFO] Found claim value {'year': 1852, 'month': 22} for position qualifier: inici: [[22 d’abril]] de [[1852]]
WARNING: API error modification-failed: Data value corrupt: Month out of allowed bounds
---------------------------------------------------------------------------
APIError                                  Traceback (most recent call last)
~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in <module>
   1775             item = get_main_item(page)
   1776             # Add statements
-> 1777             add_statements(item, position_statements, summary="Import from Catalan Wikipedia")
   1778             # Remove infotable params
   1779             remove_positions_from_page(page, infotable_params, summary="Exporta a Wikidata")

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in add_statements(item, statements, summary)
   1340     logger.info("Try to add new statements to main item")
   1341     for statement in statements:
-> 1342         add_statement(item, statement, summary=summary)
   1343
   1344

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in add_statement(item, new_statement, summary)
   1348     if not duplicated:
   1349         logger.info(f"Add statement: {new_statement.claim.value.id}")
-> 1350         item.add_statement(new_statement, summary=summary)
   1351
   1352

~\projects\wikidata\WikidataBot\wikidatabot\models.py in add_statement(self, statement, summary)
    316         data = {'claims': [statement._statement.toJSON()]}  # add the statement on property: use []
    317         # to overwrite statement on property: do not use []  # FALSE; use snak instead
--> 318         response = repo.editEntity(identification, data, summary=summary)
    319         # response is a dict: {'entity': {'labels': {'ca': {'language': 'ca', 'value': 'Joaquim Abargues i Feliu'}},
    320         #                      'descriptions': {}, 'aliases': {}, 'sitelinks': {'cawiki': {'site': 'cawiki',

c:\users\avi14827\projects\wikidata\pywikibot\pywikibot\tools\__init__.py in wrapper(*__args, **__kw)
   1742                              cls, depth)
   1743                     del __kw[old_arg]
-> 1744             return obj(*__args, **__kw)
   1745
   1746         if not __debug__:

c:\users\avi14827\projects\wikidata\pywikibot\pywikibot\site.py in callee(self, *args, **kwargs)
   1344                 raise Exception('Not implemented')
   1345
-> 1346             return fn(self, *args, **kwargs)
   1347
   1348         if not __debug__:

c:\users\avi14827\projects\wikidata\pywikibot\pywikibot\site.py in editEntity(self, entity, data, bot, **kwargs)
   8048         params['data'] = json.dumps(data)
   8049         req = self._simple_request(**params)
-> 8050         data = req.submit()
   8051         return data
   8052

c:\users\avi14827\projects\wikidata\pywikibot\pywikibot\data\api.py in submit(self)
   2078                               % result)
   2079
-> 2080                 raise APIError(**result['error'])
   2081             except TypeError:
   2082                 raise RuntimeError(result)

APIError: modification-failed: Data value corrupt: Month out of allowed bounds [messages:[{'name': 'wikibase-validator-bad-value', 'parameters': ['Month out of allowed bounds'], 'html': {'*': 'Data value corrupt: Mon
th out of allowed bounds'}}]; help:See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce
&gt; for notice of API deprecations and breaking changes.]