-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Currently rich supports printing tables without columns, but the title will be set to 1 character width:
from rich.console import Console
from rich.table import Table
table = Table(title="Star Wars Movies")
console = Console()
console.print(table)
output:
S
t
a
r
W
a
r
s
M
o
v
i
e
s
┏┓
└┘
So I want to set a min-width for the table, but raised a AssertionError:
....
File "/Users/waynerv/Repos/QData/qdatamgr-cli/venv/lib/python3.8/site-packages/rich/console.py", line 893, in render
for render_output in iter_render:
File "/Users/waynerv/Repos/QData/qdatamgr-cli/venv/lib/python3.8/site-packages/rich/table.py", line 411, in __rich_console__
widths = self._calculate_column_widths(console, max_width - extra_width)
File "/Users/waynerv/Repos/QData/qdatamgr-cli/venv/lib/python3.8/site-packages/rich/table.py", line 500, in _calculate_column_widths
pad_widths = ratio_distribute(_max_width - table_width, widths)
File "/Users/waynerv/Repos/QData/qdatamgr-cli/venv/lib/python3.8/site-packages/rich/_ratio.py", line 53, in ratio_distribute
assert total_ratio > 0, "Sum of ratios must be > 0"
AssertionError: Sum of ratios must be > 0
I take response from a API to generate columns and rows dynamically so they could be None.
Is there any way I can properly print a table without columns?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working