Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParserError on https://en.wikipedia.org/w/index.php?title=List_of_minerals_(synonyms)&oldid=704783982 #147

Closed
fabianhoward opened this issue Apr 12, 2016 · 2 comments
Assignees
Milestone

Comments

@fabianhoward
Copy link

When attempting to parse the MediaWiki text of https://en.wikipedia.org/w/index.php?title=List_of_minerals_(synonyms)&oldid=704783982 using mwparserfromhell.parse I receive the following stack trace.

Traceback (most recent call last):
  File "mwliststuff.py", line 5, in <module>
    m = mwparserfromhell.parse(text)
  File "/XXXX/venv/lib/python3.5/site-packages/mwparserfromhell/utils.py", line 58, in parse_anything
    return Parser().parse(value, context, skip_style_tags)
  File "/XXXX/venv/lib/python3.5/site-packages/mwparserfromhell/parser/__init__.py", line 93, in parse
    tokens = self._tokenizer.tokenize(text, context, skip_style_tags)
mwparserfromhell.parser.ParserError: This is a bug and should be reported. Info: C tokenizer exited with non-empty token stack.

Other potentially relevant details:

  • Python 3.5.1
  • Mac OS X 10.11.4
  • mwparserfromhell==0.4.3
@earwig
Copy link
Owner

earwig commented Jun 23, 2017

I finally figured this one out, and it was incredibly obscure. The wikicode is a bit of a mess, and has something that looks like an unpaired HTML tag (<Th) that the parser treats as such. The underlying parsing bug has been fixed, but we still get semi-garbage output (though it does match the input correctly and does not throw an exception). I think this is a GIGO case until the parser develops more accurate tag parsing abilities.

@earwig
Copy link
Owner

earwig commented Jun 23, 2017

Fixed in cd4f90e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants