[BUG] Tracebacks don't expand to fit height properly
See original GitHub issueDescribe the bug
If you put a Traceback inside a container with a height, it exactly chops off the message at the bottom (regardless of how many lines it has, tested with 1 and a longer message producing 2), and instead matches the frame around the traceback. This is currently causing an issue when placing a traceback in a panel in textual.
MWE:
import rich.traceback
import rich.panel
try:
1/0
except Exception:
rich.print(rich.panel.Panel(rich.traceback.Traceback(), height=20))
The output has chopped off the bottom of the traceback:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ โ โ
โ โ /Users/henryschreiner/git/scikit-hep/uproot-browser/tmp2.py:5 in <module> โ โ
โ โ โ โ
โ โ 2 import rich.panel โ โ
โ โ 3 โ โ
โ โ 4 try: โ โ
โ โ โฑ 5 โ 1/0 โ โ
โ โ 6 except Exception: โ โ
โ โ 7 โ rich.print(rich.panel.Panel(rich.traceback.Traceback(), height=20)) โ โ
โ โ 8 โ โ
โ โ โ โ
โ โ โ โ
โ โ โ โ
โ โ โ โ
โ โ โ โ
โ โ โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
If you do not set the height externally (remove height=20
above), then the correct height is computed:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ โ โ
โ โ /Users/henryschreiner/git/scikit-hep/uproot-browser/tmp2.py:5 in <module> โ โ
โ โ โ โ
โ โ 2 import rich.panel โ โ
โ โ 3 โ โ
โ โ 4 try: โ โ
โ โ โฑ 5 โ 1/0 โ โ
โ โ 6 except Exception: โ โ
โ โ 7 โ rich.print(rich.panel.Panel(rich.traceback.Traceback())) # , height=20)) โ โ
โ โ 8 โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ ZeroDivisionError: division by zero โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Platform
Click to expand for output
macOS iterm2.
โญโโโโโโโโโโโโโโโโโโโโโโโโโ <class 'rich.console.Console'> โโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ A high level console interface. โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ <console width=154 ColorSystem.TRUECOLOR> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ color_system = 'truecolor' โ
โ encoding = 'utf-8' โ
โ file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> โ
โ height = 45 โ
โ is_alt_screen = False โ
โ is_dumb_terminal = False โ
โ is_interactive = True โ
โ is_jupyter = False โ
โ is_terminal = True โ
โ legacy_windows = False โ
โ no_color = False โ
โ options = ConsoleOptions( โ
โ size=ConsoleDimensions(width=154, height=45), โ
โ legacy_windows=False, โ
โ min_width=1, โ
โ max_width=154, โ
โ is_terminal=True, โ
โ encoding='utf-8', โ
โ max_height=45, โ
โ justify=None, โ
โ overflow=None, โ
โ no_wrap=False, โ
โ highlight=None, โ
โ markup=None, โ
โ height=None โ
โ ) โ
โ quiet = False โ
โ record = False โ
โ safe_box = True โ
โ size = ConsoleDimensions(width=154, height=45) โ
โ soft_wrap = False โ
โ stderr = False โ
โ style = None โ
โ tab_size = 8 โ
โ width = 154 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโโโ <class 'rich._windows.WindowsConsoleFeatures'> โโโโโฎ
โ Windows features available. โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ WindowsConsoleFeatures(vt=False, truecolor=False) โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ truecolor = False โ
โ vt = False โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโโโโโโ Environment Variables โโโโโโโโฎ
โ { โ
โ 'TERM': 'xterm-256color', โ
โ 'COLORTERM': 'truecolor', โ
โ 'CLICOLOR': None, โ
โ 'NO_COLOR': None, โ
โ 'TERM_PROGRAM': 'iTerm.app', โ
โ 'COLUMNS': None, โ
โ 'LINES': None, โ
โ 'JPY_PARENT_PID': None, โ
โ 'VSCODE_VERBOSE_LOGGING': None โ
โ } โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
platform="Darwin"
rich==11.2.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Bug listing with status RESOLVED with resolution FIXED as at ...
Bug :2 - "How do I attach an ebuild." status:RESOLVED resolution:FIXED ... Bug:518 - "postgresql init scripts don't match the installed location of...
Read more >size of a background image in tkinter - Stack Overflow
I don't know about PIL, but I can show you how to do it in tkinter: ... highlightthickness=0) canvas.pack(expand = YES, fill =...
Read more >AqEquil.AqSpeciation API documentation - WORM Portal
By default, errors that are handled by AqEquil are printed with an error message, but no traceback. Errors that are not handled by...
Read more >NameError: name '**' is not defined - GIS Stack Exchange
QtGui and processing and after having correctly defined layers, I executed this script in PyQGIS but it returns this error: Traceback (mostย ...
Read more >Options and settings โ pandas 1.5.2 documentation
When called with no argument describe_option() will print out the ... the height of the terminal and print a truncated object which fits...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Textual v0.1.17 bumps the Rich dependancy
The issue is that height is being passed to the panel within the traceback. There are a few issue like this to be resolved, since prior to Textual Rich didnโt have any concept of height.