Page MenuHomePhabricator

ErfgoedBot categorisation fails with 'unicode' object has no attribute 'isHiddenCategory'
Closed, ResolvedPublic


Traceback (most recent call last):
  File "/data/project/heritage/pywikibot/", line 263, in <module>
    if not main():
  File "/data/project/heritage/pywikibot/", line 257, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "/data/project/heritage/pywikibot/", line 121, in run_python_file
  File "/data/project/heritage/erfgoedbot/", line 557, in <module>
  File "/data/project/heritage/erfgoedbot/", line 547, in main
    countrycode, lang, countryconfig, commonsCatTemplates, conn, cursor)
  File "/data/project/heritage/erfgoedbot/", line 427, in processCountry
    commonsCatTemplates, page, conn, cursor, harvest_type)
  File "/data/project/heritage/erfgoedbot/", line 107, in categorizeImage
    replace_default_cat_with_new_categories_in_image(page, commonsCategoryBase, newcats, comment, verbose=True)
  File "/data/project/heritage/erfgoedbot/", line 202, in replace_default_cat_with_new_categories_in_image
  File "/data/project/heritage/erfgoedbot/", line 242, in filter_out_categories_to_add
  File "/data/project/heritage/erfgoedbot/", line 241, in <lambda>
    final_categories = filter(lambda cat: not cat.isHiddenCategory(),
AttributeError: 'unicode' object has no attribute 'isHiddenCategory'
CRITICAL: Closing network session.
<type 'exceptions.AttributeError'>

Event Timeline

Sounds like a category name, rather then a pywikibot.Category object, made it's way into the list

For which run/country did you get this?

Change 377927 had a related patch set uploaded (by Lokal Profil; owner: Lokal Profil):
[labs/tools/heritage@master] Ensure all added categories are pywikibot.Category objects

Change 377927 merged by jenkins-bot:
[labs/tools/heritage@master] Ensure all added categories are pywikibot.Category objects

Thanks for looking into it @Lokal_Profil !I just saw it in the logs − no clue what country/file it was. We need better exception handling for this :-/