lahwaacz/wiki-scripts

toc.py: Non-existing children of language categories are created under the wrong category

Closed this issue · 1 comments

...and then a wrong "English (Language)" category is created as well. This is a rare bug actually.

Diffs/new pages: 1 2 3 4 5(now deleted)

First run:

INFO     Fixing language of categories on page [[Intel graphics (Português)]]...
--- Intel graphics (Português).old	2017-02-03T19:51:08Z
+++ Intel graphics (Português).new	<utcnow>
@@ -1,5 +1,5 @@
-[[Category:Graphics]]
-[[Category:X server]]
+[[Category:Graphics (Português)]]
+[[Category:X server (Português)]]
 [[cs:Intel graphics]]
 [[de:Intel]]
 [[es:Intel graphics]]
Edit summary:  fix category, see [[Help:Category#i18n category name]]
Make this edit? [y,n,q,e,?]? y
INFO     Editing page [[Intel graphics (Português)]] ...
INFO     Fixing language of categories on page [[Intel Graphics (Português)]]...
--- Intel Graphics (Português).old	2017-02-03T19:56:18Z
+++ Intel Graphics (Português).new	<utcnow>
@@ -1,8 +1,8 @@
-[[Category:Graphics]]
-[[Category:X server]]
-[[en:Intel graphics]]
+[[Category:Graphics (Português)]]
+[[Category:X server (Português)]]
 [[cs:Intel graphics]]
 [[de:Intel]]
+[[en:Intel graphics]]
 [[es:Intel graphics]]
 [[fr:Intel]]
 [[hu:Intel graphics]]
Edit summary:  fix category, see [[Help:Category#i18n category name]]
Make this edit? [y,n,q,e,?]? y
INFO     Editing page [[Intel Graphics (Português)]] ...
INFO     All pages are categorized under correct language.
INFO     Creating page [[Category:Graphics (Português)]] ...
INFO     rate limit for function API.create exceeded, sleeping for 9.189 seconds
INFO     Creating page [[Category:Hardware (Português)]] ...
INFO     Creating page [[Category:English (Português)]] ...
Traceback (most recent call last):
  File "toc.py", line 363, in <module>
    toc.run()
  File "toc.py", line 300, in run
    graph.init_wanted_categories()
  File "/home/dario/dev/arch/wiki-scripts/ws/interlanguage/CategoryGraph.py", line 189, in init_wanted_categories
    self.create_category(page["title"])
  File "/home/dario/dev/arch/wiki-scripts/ws/interlanguage/CategoryGraph.py", line 185, in create_category
    self.create_category(p)
  File "/home/dario/dev/arch/wiki-scripts/ws/interlanguage/CategoryGraph.py", line 185, in create_category
    self.create_category(p)
  File "/home/dario/dev/arch/wiki-scripts/ws/interlanguage/CategoryGraph.py", line 185, in create_category
    self.create_category(p)
  File "/home/dario/dev/arch/wiki-scripts/ws/interlanguage/CategoryGraph.py", line 178, in create_category
    parents = [lang.format_title(lang.detect_language(p)[0], langname) for p in self.parents[local]]
KeyError: 'Category:Languages'

Re-attempting a run generated:

INFO     All pages are categorized under correct language.
INFO     All pages are categorized under correct language.
Traceback (most recent call last):
  File "toc.py", line 363, in <module>
    toc.run()
  File "toc.py", line 300, in run
    graph.init_wanted_categories()
  File "/home/dario/dev/arch/wiki-scripts/ws/interlanguage/CategoryGraph.py", line 189, in init_wanted_categories
    self.create_category(page["title"])
  File "/home/dario/dev/arch/wiki-scripts/ws/interlanguage/CategoryGraph.py", line 178, in create_category
    parents = [lang.format_title(lang.detect_language(p)[0], langname) for p in self.parents[local]]
KeyError: 'Category:Languages'

Manually fixing the categorization issues restored the functionality.

Oops, I'm surprised it hasn't broken sooner. Should be fixed in 7cb0122.