rich: [BUG] Rich traceback not working proprely within notebook
Describe the bug
When the rich traceback is enabled in a notebook, the traceback is almost unreadable and show a criptic message:
tmp/ipykernel_1565558/3782956317.py:1 in <cell line: 1>                                  โ                                                                                          
 [Errno 2] No such file or directory: '/tmp/ipykernel_1565558/3782956317.py'               โ
Here is a screenshot that showcase the issue with a very simple traceback.

One could say that there is no point of activating the trackback from inside a notebook. However the problem persist when importing a library that enable rich traceback. (Ex in my case docarray or jina)

thanks in advance for any support ๐ !!
Platform
Click to expand
Linux, running from jupyter notebook
from rich.diagnose import report
report()
โญโโโโโโโโโโโโโโโโโโโโโโ <class 'rich.console.Console'> โโโโโโโโโโโโโโโโโโโโโโโฎ
โ A high level console interface.                                            โ
โ                                                                            โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ <console width=93 ColorSystem.TRUECOLOR>                               โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ                                                                            โ
โ     color_system = 'truecolor'                                             โ
โ         encoding = 'utf-8'                                                 โ
โ             file = <ipykernel.iostream.OutStream object at 0x7f26f700bcd0> โ
โ           height = 100                                                     โ
โ    is_alt_screen = False                                                   โ
โ is_dumb_terminal = False                                                   โ
โ   is_interactive = False                                                   โ
โ       is_jupyter = True                                                    โ
โ      is_terminal = False                                                   โ
โ   legacy_windows = False                                                   โ
โ         no_color = False                                                   โ
โ          options = ConsoleOptions(                                         โ
โ                        size=ConsoleDimensions(width=93, height=100),       โ
โ                        legacy_windows=False,                               โ
โ                        min_width=1,                                        โ
โ                        max_width=93,                                       โ
โ                        is_terminal=False,                                  โ
โ                        encoding='utf-8',                                   โ
โ                        max_height=100,                                     โ
โ                        justify=None,                                       โ
โ                        overflow=None,                                      โ
โ                        no_wrap=False,                                      โ
โ                        highlight=None,                                     โ
โ                        markup=None,                                        โ
โ                        height=None                                         โ
โ                    )                                                       โ
โ            quiet = False                                                   โ
โ           record = False                                                   โ
โ         safe_box = True                                                    โ
โ             size = ConsoleDimensions(width=93, height=100)                 โ
โ        soft_wrap = False                                                   โ
โ           stderr = False                                                   โ
โ            style = None                                                    โ
โ         tab_size = 8                                                       โ
โ            width = 93                                                      โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโโโ <class 'rich._windows.WindowsConsoleFeatures'> โโโโโฎ
โ Windows features available.                           โ
โ                                                       โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ WindowsConsoleFeatures(vt=False, truecolor=False) โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ                                                       โ
โ truecolor = False                                     โ
โ        vt = False                                     โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโโโโโโ Environment Variables โโโโโโโโฎ
โ {                                  โ
โ     'TERM': 'xterm-color',         โ
โ     'COLORTERM': None,             โ
โ     'CLICOLOR': '1',               โ
โ     'NO_COLOR': None,              โ
โ     'TERM_PROGRAM': None,          โ
โ     'COLUMNS': None,               โ
โ     'LINES': None,                 โ
โ     'JPY_PARENT_PID': '1483554',   โ
โ     'VSCODE_VERBOSE_LOGGING': None โ
โ }                                  โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
platform="Linux"
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 16
Hello, we have the same issue, has anyone found a way to avoid this? I tried with rich 12.6.0, 11.2.0, and 10.16.2 and still get the same problem (No such file or directory: /tmp/โฆ for each line of the traceback wich comes from the notebook) and Iโm pretty sure it worked at some point before upgrading but I didnโt manage to get it working again. Thanks!
Thanks for the explanation @maartenbreddels
Tracebacks are fixed in 13.1.0 (just released).
I agree, but seeing it being used in traceback.py and ipython, I thought this was probably poured in concrete a long time ago.
There doesnโt appear to be any way to workaround this in Rich. The paths reported in the traceback donโt exist, so there is no way to get the relevant code.
Iโve reported this issue to the Jupyterlab repo.