question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] rich.traceback.install(width: int) is ignored when stderr is not a tty

See original GitHub issue

Rich traceback output is forced to a width of 80 columns when there is no tty on neither stdout nor stderr:

./im_going_to_crash.py  2>&1 | cat

This is in spite of me setting the width in rich.traceback.install to something else. It is completely ignored and seem to simply use the value 80.

Possible inconsistency: The function default value seem to be set to 100, different from rich.console.Console which seem to default width to None.

Rich version: 10.16.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
willmcgugancommented, Jan 6, 2022

When there is no tty, Rich is unable to detect the width of the terminal, and so defaults to a maximum of 80 characters.

If you know the width, you can set the COLUMNS environment variable.

0reactions
taranlu-houzzcommented, Aug 31, 2022

Also, when running my script, I can use COLUMNS to reduce the width, but it seems to cap out at 100 regardless of what I set for width (I assume since that is the default).

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] rich.traceback.install(width: int) is ignored when stderr is not a tty
When there is no tty, Rich is unable to detect the width of the terminal, and so defaults to a maximum of 80...
Read more >
rich/console.py at master · Textualize/rich - GitHub
Rich is a Python library for rich text and beautiful formatting in the terminal. ... def update_width(self, width: int) -> "ConsoleOptions":.
Read more >
Source code for rich.console - Rich's documentation!
Args: width (int): New width (sets both min_width and max_width) Returns: ... stderr (bool, optional): Use stderr rather than stdout if ``file`` is...
Read more >
Release Notes — Airflow Documentation
In order to make airflow dags test more useful as a testing and debugging tool, we no longer run a backfill job and...
Read more >
Changelog — Python 3.11.1 documentation
gh-97527: Fix a bug in the previous bugfix that caused IDLE to not start when run with 3.10.8, 3.12.0a1, and at least Microsoft...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found