lahwaacz / wiki-scripts

Framework for writing bots, maintenance scripts or performing data analysis on wikis powered by MediaWiki
http://lahwaacz.github.io/wiki-scripts/
GNU General Public License v3.0
27 stars 12 forks source link

toc.py: AttributeError: 'str' object has no attribute 'get_ancestors' #43

Closed kynikos closed 7 years ago

kynikos commented 7 years ago

Hi, this may be some instability due due to the big ongoing developments, but here it is, it happened with toc.py -s on 6355c48eb4ceb1c82dc6a71a1ead9c952df8eab6 :)

INFO     All pages are categorized under correct language.
INFO     Decategorizing page [[User:Invapid/Cobalt strike]]...
Traceback (most recent call last):
  File "toc.py", line 363, in <module>
    toc.run()
  File "toc.py", line 293, in run
    decat.fix_allpages()
  File "/home/dario/dev/arch/wiki-scripts/ws/interlanguage/Decategorization.py", line 65, in fix_allpages
    text_new = self.decategorize(page["title"], text_old)
  File "/home/dario/dev/arch/wiki-scripts/ws/interlanguage/Decategorization.py", line 46, in decategorize
    parent, magics, cats, langlinks = get_header_parts(wikicode, remove_from_parent=True)
  File "/home/dario/dev/arch/wiki-scripts/ws/ArchWiki/header.py", line 118, in get_header_parts
    if _is_in_includeonly(template):
  File "/home/dario/dev/arch/wiki-scripts/ws/ArchWiki/header.py", line 108, in _is_in_includeonly
    ancestors = wikicode.get_ancestors(node)
  File "/usr/lib/python3.6/site-packages/mwparserfromhell/string_mixin.py", line 111, in __getattr__
    return getattr(self.__unicode__(), attr)
AttributeError: 'str' object has no attribute 'get_ancestors'
lahwaacz commented 7 years ago

I just tried it and it worked OK. Even the get_ancestors method in mwparserfromhell is relatively new (since https://github.com/earwig/mwparserfromhell/commit/d7c755f5263cbd5d57ff0631b95b8dfded94daf5) so you might be using an old version...

kynikos commented 7 years ago

Indeed, I'm using your python-mwparserfromhell-git AUR package, but I didn't rebuild it since 0.4.4, now I've added it to my list of VCS packages to rebuild periodically, I'm closing this and assume that that was really the problem, cheers.