albertvillanova / WikidataBot

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

[scripts] transfer_infotable crashes with AttributeError #30

Closed albertvillanova closed 4 years ago

albertvillanova commented 4 years ago
2020-02-11 14:01:21,537 [    INFO] Parse position value: [[Llista dels Ministres d'Afers Exteriors d'Espanya|Ministre d'Estat]]
2020-02-11 14:01:21,537 [    INFO] Get office held by head from link Llista dels Ministres d'Afers Exteriors d'Espanya
2020-02-11 14:01:21,537 [ WARNING] Link is a list
2020-02-11 14:01:21,537 [    INFO] Get item from page link Llista dels Ministres d'Afers Exteriors d'Espanya
2020-02-11 14:01:22,209 [ WARNING] No Wikidata item from ca page link: Llista dels Ministres d'Afers Exteriors d'Espanya
2020-02-11 14:01:22,381 [ WARNING] No Wikidata item from es page link: Llista dels Ministres d'Afers Exteriors d'Espanya
2020-02-11 14:01:22,584 [ WARNING] No Wikidata item from gl page link: Llista dels Ministres d'Afers Exteriors d'Espanya
2020-02-11 14:01:22,771 [   ERROR] No Wikidata item from (ca, es, gl, en) page links: Llista dels Ministres d'Afers Exteriors d'Espanya
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in <module>
    435         positions = extract_positions(infotable_params)
    436         logger.info(f"Positions: {positions}")
--> 437         position_claims = create_position_claims(positions)
    438
    439         # DEBUG

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in create_position_claims(positions)
    405     claims = []
    406     for position in positions:
--> 407         position_claim, qualifiers = parse_position(position)
    408         # for position_param, position_value in position.items():
    409         #     # carrec

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in parse_position(position)
    380 def parse_position(position):
    381     logger.info(f"Parse position: {position}")
--> 382     position_claim, qualifiers = parse_position_value(position['carrec'])
    383     for position_key, position_value in position.items():
    384         # carrec

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in parse_position_value(position_value)
    287             #     position_item = MINISTER_OF_THE_NAVY_OF_SPAIN
    288             else:
--> 289                 position_item = get_office_held_by_head_from_link(position_link)
    290         elif position_text.lower().startswith("president"):
    291             if position_link.lower().startswith("president"):

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in get_office_held_by_head_from_link(link)
    207         logger.warning(f"Link is a list")
    208     organization_item = get_item_from_page_link(link)
--> 209     office_claims = organization_item.claims.get(OFFICE_HELD_BY_HEAD_OF_GOVERNMENT)
    210     if not office_claims:
    211         office_claims = organization_item.claims.get(OFFICE_HELD_BY_HEAD_OF_THE_ORGANIZATION)

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