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. Screenshot from 2022-05-11 13-56-59

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)

Screenshot from 2022-05-11 13-31-58

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

Most upvoted comments

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.