Skip to content

Commit 8b62985

Browse files
committed
fix #453: put_table() error when table data is empty with rich header
1 parent a52b378 commit 8b62985

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pywebio/output.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,10 @@ def put_table(tdata, header=None, scope=None, position=OutputPosition.BOTTOM) ->
657657
tdata = [list(i) for i in tdata] # copy data
658658

659659
if header:
660+
# when tdata is empty, header will not be process
661+
# see https://github.com/pywebio/PyWebIO/issues/453
662+
if isinstance(header[0], (list, tuple)):
663+
header = [h[0] for h in header]
660664
tdata = [header, *tdata]
661665

662666
span = {}

0 commit comments

Comments
 (0)