#1824·rich

[bug] rich + crlf = notepad python

Author: tx46Created Jan 11, 2022Updated Sep 5, 2026
Labelswindows

How to h4x?

After approx. 12 hours of debugging why my app is silently crashing, I have finally figured out the cause. Here's a minimal (non-)working example file for you to work on, lol. It only crashes on Windoze, and it does so in a really nasty way which seems to entirely screw up the Python runtime. Line 1088 in one of the rich source files may be related.

import os
import time

from rich.layout import Layout
from rich.live import Live
from rich.text import Text

text = Text()
text.append(Text("foo" + os.linesep, style="yellow"))
layout = Layout(renderable=text)

with Live(layout):
    while True:
        time.sleep(0.1)

Screenshot

(bild borttagen)

Platform

Windows 10 Command Prompt in a VM, but also tested on live Windows 10 system. Does not crash on Linux.

┌─────────────────────── <class 'rich.console.Console'> ───────────────────────┐
│ A high level console interface.                                              │
│                                                                              │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ <console width=189 ColorSystem.WINDOWS>                                  │ │
│ └──────────────────────────────────────────────────────────────────────────┘ │
│                                                                              │
│     color_system = 'windows'                                                 │
│         encoding = 'utf-8'                                                   │
│             file = <colorama.ansitowin32.StreamWrapper object at 0x01809C10> │
│           height = 42                                                        │
│    is_alt_screen = False                                                     │
│ is_dumb_terminal = False                                                     │
│   is_interactive = True                                                      │
│       is_jupyter = False                                                     │
│      is_terminal = True                                                      │
│   legacy_windows = True                                                      │
│         no_color = False                                                     │
│          options = ConsoleOptions(                                           │
│                        size=ConsoleDimensions(width=189, height=42),         │
│                        legacy_windows=True,                                  │
│                        min_width=1,                                          │
│                        max_width=189,                                        │
│                        is_terminal=True,                                     │
│                        encoding='utf-8',                                     │
│                        max_height=42,                                        │
│                        justify=None,                                         │
│                        overflow=None,                                        │
│                        no_wrap=False,                                        │
│                        highlight=None,                                       │
│                        markup=None,                                          │
│                        height=None                                           │
│                    )                                                         │
│            quiet = False                                                     │
│           record = False                                                     │
│         safe_box = True                                                      │
│             size = ConsoleDimensions(width=189, height=42)                   │
│        soft_wrap = False                                                     │
│           stderr = False                                                     │
│            style = None                                                      │
│         tab_size = 8                                                         │
│            width = 189                                                       │
└──────────────────────────────────────────────────────────────────────────────┘
platform="Windows"
WindowsConsoleFeatures(vt=False, truecolor=False)
rich==11.0.0