albertvillanova / WikidataBot

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

[scripts] transfer_infotable crashes with KeyError #50

Closed albertvillanova closed 4 years ago

albertvillanova commented 4 years ago
2020-03-22 09:05:37,322 [    INFO] Start Page 2290: [[wikipedia:ca:Aureli Ferrando Muria]]
2020-03-22 09:05:37,961 [    INFO] Infotable parameters: OrderedDict([('nom', 'Aureli Ferrando Muria'), ('data_naixement', '{{data naixement i edat|1952|3|3}}'), ('lloc_naixement', '[[Albocàsser]] ([[País Valencià]])
'), ('k_etiqueta', 'Circumscripció'), ('carrec2', 'Diputat a les [[Corts Valencianes]]'), ('escut_carrec2', 'Escudo de la Comunidad Valenciana.svg'), ('inici2', '[[2 de juliol]] de [[1987]]'), ('final2', '[[18 de jun
y]] de [[1991]]'), ('k_etiqueta2', 'Circumscripció'), ('k_etiqueta3', 'Circumscripció'), ('partit_politic', '[[Unitat del Poble Valencià]]'), ('ocupacio', 'Professor i polític')])
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in <module>
   1787             if not infotable_params:
   1788                 raise SkipPageError
-> 1789             positions = extract_positions(infotable_params)
   1790             logger.info(f"Positions: {positions}")
   1791             position_statements = create_position_statements(positions)

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in extract_positions(template_params)
    539         # Propagate 'carrec'
    540         if 'carrec' not in position:
--> 541             position['carrec'] = positions[i - 1]['carrec']
    542         # Propagate year from final to inici
    543         if 'inici' in position and 'final' in position:

KeyError: 'carrec'