rich: [BUG] Can't print in Jupyter console or qtconsole (but can in jupyter lab)

image This is what I get when I try to do rich.print in jupyter console or qtconsole. But in jupyterlab it is able to print.

I have installed rich using pip install rich[jupyter] Python version: 3.9 Jupyter (qt)console version: Latest

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (7 by maintainers)

Most upvoted comments

import colorama
from rich.console import Console
from rich.markdown import Markdown
from rich.syntax import Syntax

colorama.deinit()
colorama.init(convert=False, strip=False)
console = Console(force_jupyter=False, color_system="truecolor")
# same example as before follows

image

That’s probably a work around which could be suggested to other QtConsole users on Windows. For my own purpose, I’ll just need to change the theme.

I have been playing with colorama.deinit() after importing modules from Rich, and doing colorama.init() with different options. This seems to work after a fashion: the colour output is renabled when printing with ansi codes directly; italics in markdown are supported and the number for list items are in red (I don’t know if this is supposed to be the case).

I’ll play with it some more and see if I can get something to work. image