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] Sometimes use console.print render table instance with keywords

See original GitHub issue

Describe the bug Sometimes use console.print render table instance with keywords [, rich will crash. example under below.

ps: if I change Console param width size bigger than a’s length, this crash will disappear, at the same change the a’s length little than width size, at the same as cancel justify or overflow param of add_column.

I thought this problem cause by words split when rendering table, and then use “####” to search style.

To Reproduce

from rich.console import Console
from rich.table import Table

cons = Console(width=100)
a = "[#######.................] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [#######.................]"
t = Table(title=f"xxx")
t.add_column("Output", justify="full", style="cyan", overflow="fold")
t.add_row(a)
cons.print(t)

Platform full platform

Diagnose

# python -m rich.diagnose
<console width=187 ColorSystem.TRUECOLOR>
# python -m rich._windows
platform="Darwin"
WindowsConsoleFeatures(vt=False, truecolor=False)
# pip freeze | grep rich
rich==9.9.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
willmcgugancommented, Feb 5, 2021

Do you think we need some change to make style parsing more robust?

There will be a fix in the next version.

0reactions
b3wshcommented, Feb 7, 2021

Thank you for your excellent job, I have tried to solve this, but do not find a better way, just wanna for some good code to learn. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to mix use of console.log() and progress bar? #64
I wonder whether it is possible to mix use console.log() or print() together with progress bar? That is we have the progress bar...
Read more >
Reactjs: Unexpected token '<' Error - Stack Overflow
Sometimes you might face an issue that the render() method can't find the target element. This happens because the react code is executed...
Read more >
Debugging guide | Google Earth Engine
When you're testing the function without mapping it, you can use print statements to understand the problem. Consider the following example:.
Read more >
Display Rich Text In The Console Using Python
An Amazing Python library for rich text displaying. Syntax highlight, tables, traceback, dynamic progress bar for command-line interface CLI ...
Read more >
Console Class (System) | Microsoft Learn
Represents the standard input, output, and error streams for console applications. ... If you run the example on a system that uses console...
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