question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bgcolor highlighting of ast nodes in traceback may be unreadable

See original GitHub issue

The commit https://github.com/ipython/ipython/commit/3026c205487897f6874b2ff580fe0be33e36e033 introduced a change with a hard-coded bg:ansiyellow color.

Unfortunately, for some terminal color schemes, white-on-yellow may be unreadable, for example: image

Changing to bg:ansired looks better: image

Is it possible to make this option configurable?

Thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
amerlyqcommented, Apr 17, 2022

Linked issue is locked, and as I understood it mostly focused on choosing new default color/style instead of exposing Token.ExecutingNode for style_overrides config option.

Mentioning that “bg:ansiyellow” is being only used as fallback in stack_data.style_with_executing_node(style, "bg:ansiyellow") is wrong. Because its value is used as override:

def style_with_executing_node(style, modifier):
    from pygments.styles import get_style_by_name
    if isinstance(style, str):
        style = get_style_by_name(style)

    class NewStyle(style):
        for_executing_node = True

        styles = {
            **style.styles,
            **{
                k.ExecutingNode: v + " " + modifier
                for k, v in style.styles.items()
            }
        }

Therefore we really don’t have a way to modify it from user config – only through modifiying sources itself.

1reaction
0xquadcommented, Aug 27, 2022

Has there been plans to fix this issue?

First use after many years and experienced the problem immediately. Errors are unreadable, so the tool basically becomes impossible to use normally. I have to run things in a simple python console instead to see anything.

FYI I’m on Windows with Putty (Kitty fork). Tweaking the terminal colors is a huge hack at the very least and not a solution: only IPython outputs unreadable text (white on bright yellow) from all the things I’ve been using in the past years. (I’m actually surprised that it wasn’t fixed before; it really should be a blocking issue in my book. Am I the only one having this issue? Otherwise is there any way I can disable this whole colored output in IPython (not the terminal) in order to restore usability?)

Also the original issue was locked (“off-topic” ?) so no one can comment there. Perhaps work is being done elsewhere?

Thanks for all the efforts put in IPython nonetheless, it’s excellent!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ast — Abstract Syntax Trees
The ast module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each...
Read more >
PyCharm 173.3727.137 Release Notes | Knowledge Base
Bug, PY-20987, Spelling inspection doesn't report typos for consecutive nodes of a "glued" string literal if the first node doesn't have a prefix....
Read more >
pandoc
Add new internal module Text.Pandoc.Writers.GridTable (Albert Krewinkel). Text.Pandoc.Highlighting: Change type of languagesByExtension , adding a parameter for ...
Read more >
Bug List
Chandra, VERI, FIXE, [9] Nodes for module path and class path on Java Build Path ... [refactoring scripts] Traceback when examining properties for...
Read more >
https://raw.githubusercontent.com/oracle-quickstar...
import ast import codecs import copy import datetime as dt import itertools import json import logging import math import os import pickle import...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found