1. Georg Brandl
  2. pygments-main
  3. Issues
Issue #1311 new

HTML Highlighting of User-Defined Python Exceptions generates a pygments.filters.ErrorToken

Sarah Clinch
created an issue

Originally reported in: https://github.com/sphinx-doc/sphinx/issues/2830.

Calling the pygments.highlight() function with a source example that includes raising an exception and the traceback sometimes generates a pygments.filters.ErrorToken.

As far as I can tell, this seems to apply when trying to highlight an example with a user-defined exception, I don't see it with a built-in.

In the attached example file, I provide an example of the problem based on example that has the exception raised in an interactive terminal window (>>>) -- I have seen the same problem for examples that assume you're working in a source file too though.