Page MenuHomePhabricator

integraality crashes when using 'grouping_link' if the English label is missing
Closed, ResolvedPublic

Description

Identified at https://www.wikidata.org/wiki/Wikidata:WikiProject_sum_of_all_paintings/Property_statistics/Sandbox − although the crash was silent, just resulting in a 502. Had to reproduce manually directly in property_statistics.py.

When grouping_link is used, integraality looks up the English label of the item (which is debatable, and under re-consideration at T237276: Re-evaluate the grouping-link behaviour ).

However, if the item has no English label, then this fails with:

Traceback (most recent call last):
  File "./integraality/property_statistics.py", line 681, in <module>
    main()
  File "./integraality/property_statistics.py", line 677, in main
    print(stats.retrieve_and_process_data())
  File "./integraality/property_statistics.py", line 619, in retrieve_and_process_data
    text += self.make_stats_for_one_grouping(grouping, item_count, higher_grouping)
  File "./integraality/property_statistics.py", line 546, in make_stats_for_one_grouping
    label = group_item.labels["en"]
  File "/usr/local/lib/python3.7/site-packages/pywikibot/page/_collections.py", line 46, in __getitem__
    return self._data[key]
KeyError: 'en'

Event Timeline

This took a long long time to investigate − the crash could be reproduced, but the error would only bubble up on the command line :/

Mentioned in SAL (#wikimedia-cloud) [2021-05-22T12:59:41Z] <wm-bot> <jeanfred> Deploy d4fa363 (T283287)

JeanFred triaged this task as Medium priority.