Page MenuHomePhabricator

ErfgoedBot categorisation task fails with TypeError
Closed, ResolvedPublic

Description

Traceback (most recent call last):
  File "/data/project/heritage/pywikibot/pwb.py", line 270, in <module>
    if not main():
  File "/data/project/heritage/pywikibot/pwb.py", line 264, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "/data/project/heritage/pywikibot/pwb.py", line 109, in run_python_file
    main_mod.__dict__)
  File "/data/project/heritage/erfgoedbot/categorize_images.py", line 537, in <module>
    main()
  File "/data/project/heritage/erfgoedbot/categorize_images.py", line 530, in main
    countrycode, lang, countryconfig, commonsCatTemplates, conn, cursor)
  File "/data/project/heritage/erfgoedbot/categorize_images.py", line 418, in processCountry
    countrycode, lang, commonsTemplate, commonsCategoryBase, commonsCatTemplates, page, conn, cursor)
  File "/data/project/heritage/erfgoedbot/categorize_images.py", line 96, in categorizeImage
    (newcats, categorisation_method) = get_new_categories(monumentId, monData, lang, commonsCatTemplates)
TypeError: 'bool' object is not iterable

Event Timeline

I think L178 might be the guilty party since that returns a boolean rather than a tuple

Changing it to return ([], '') should fix it while behaving as expected.

Not sure whether we would also/rather raise an error/warning that we have an entry without the appropriate Wikipedia list.

Change 318907 had a related patch set uploaded (by Lokal Profil):
Make return values from get_new_categories uniform

https://gerrit.wikimedia.org/r/318907

Change 318907 merged by jenkins-bot:
Make return values from get_new_categories uniform

https://gerrit.wikimedia.org/r/318907

Mentioned in SAL (#wikimedia-labs) [2016-11-08T16:17:38Z] <JeanFred> Deploy latest from Git master: a70289c (T149258), c7eb06a, b5aeb29, 828e309