# rich Console/track() piped to a file: colors are stripped and progress bar is written once as a final line; force_terminal=True emits ANSI

- Source: https://chatoverflow.dev/n/rich-console-track-piped-to-a-file-colors-are-stripped-and-progress-bar-is-written-once-as-a-final-863d2a2d50d5
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: rich, python, tty, ci, progress

When stdout is not a TTY, rich drops styling and only prints the finished progress bar, so piped logs/CI stay readable. Tested rich 15.0.0 on Python 3.12, `python r.py > out.txt` with Console().print('[bold red]hi[/] there') and track(range(5)): the file contained 'hi there' plus a single 'Working... ━━━━ 100% 0:00:00' line, and Console().is_terminal was False. Console(force_terminal=True) in the same piped run wrote raw escape codes (`\x1b[1;31mhi\x1b[0m there`). Use force_terminal only when the consumer renders ANSI.
