albertvillanova / WikidataBot

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

[scripts] transfer_infotable crashes with AttributeError #39

Closed albertvillanova closed 4 years ago

albertvillanova commented 4 years ago
2020-02-17 16:48:03,133 [    INFO] Parse position value: [[Llista d'alcaldes de la Ciutat de Luxemburg|Alcalde de la Ciutat de Luxemburg<br/>Primer mandat]]
2020-02-17 16:48:03,133 [    INFO] Get page from page link Llista d'alcaldes de la Ciutat de Luxemburg
2020-02-17 16:48:03,474 [    INFO] Found Wikipedia page from ca page link Llista d'alcaldes de la Ciutat de Luxemburg: [[wikipedia:ca:Llista d'alcaldes de la ciutat de Luxemburg]]
2020-02-17 16:48:03,475 [    INFO] Get office held by head from organization: [[wikipedia:ca:Llista d'alcaldes de la ciutat de Luxemburg]]
2020-02-17 16:48:03,476 [    INFO] Get organization link from list link Llista d'alcaldes de la ciutat de Luxemburg, using word alcalde
2020-02-17 16:48:03,477 [    INFO] Got organization link la ciutat de Luxemburg from list link Llista d'alcaldes de la ciutat de Luxemburg
2020-02-17 16:48:03,478 [    INFO] Get page from page link la ciutat de Luxemburg
2020-02-17 16:48:03,655 [ WARNING] No Wikipedia page from ca page link la ciutat de Luxemburg
2020-02-17 16:48:03,988 [ WARNING] No Wikipedia page from es page link la ciutat de Luxemburg
2020-02-17 16:48:04,162 [ WARNING] No Wikipedia page from gl page link la ciutat de Luxemburg
2020-02-17 16:48:04,334 [ WARNING] No Wikipedia page from en page link la ciutat de Luxemburg
2020-02-17 16:48:04,335 [   ERROR] No Wikipedia page from (ca, es, gl, en) page links: la ciutat de Luxemburg
2020-02-17 16:48:04,336 [    INFO] Get item from page None
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in <module>
    701         positions = extract_positions(infotable_params)
    702         logger.info(f"Positions: {positions}")
--> 703         position_claims = create_position_claims(positions)
    704
    705         # DEBUG

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in create_position_claims(positions)
    676     claims = []
    677     for position in positions:
--> 678         position_claim, qualifiers = parse_position(position)
    679         if not position_claim:
    680             logger.error(f"No position claim: skipped position {position}")

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in parse_position(position)
    615         logger.error(f"Malformed position does not contain 'carrec': {position}")
    616         return None, []
--> 617     position_claim, qualifiers = parse_position_value(position['carrec'])
    618     # Position qualifiers
    619     logger.info("Parse position qualifiers")

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in parse_position_value(position_value)
    438                 position_item = get_item_from_page(position_page)
    439             else:
--> 440                 position_item = get_office_held_by_head(position_page, from_list_of="alcalde")
    441         # diputa
    442         elif position_text.lower().startswith("diputa"):

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in get_office_held_by_head(organization_page, head_of, from_list_of, prepend_to_list_of)
    327                                                                  prepend=prepend_to_list_of)
    328     # Organization item
--> 329     organization_item = get_item_from_page(organization_page)
    330     if not organization_item:
    331         logger.error(f"No organization item found from organization: {organization_page}")

~\projects\wikidata\WikidataBot\scripts\transfer_infotable.py in get_item_from_page(page)
    222     logger.info(f"Get item from page {page}")
    223     try:
--> 224         item = pw.ItemPage.fromPage(page)
    225     except pw.NoPage:
    226         logger.error(f"No Wikidata item from page: {page}")

c:\users\avi14827\projects\wikidata\pywikibot\pywikibot\page.py in fromPage(cls, page, lazy_load)
   4516         if hasattr(page, '_item'):
   4517             return page._item
-> 4518         if not page.site.has_data_repository:
   4519             raise pywikibot.WikiBaseError('{0} has no data repository'
   4520                                           ''.format(page.site))

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