Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[html] prevent error when parsing an empty table #2140

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions visidata/loaders/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,11 @@ def iterload(self):
if headers:
it = itertools.zip_longest(*headers, fillvalue='')
else:
it = list(list(x) for x in self.rows.pop(0))
it += [''] * (ncols-len(it))
if len(self.rows) > 0:
it = list(list(x) for x in self.rows.pop(0))
it += [''] * (ncols-len(it))
else:
it = []

for colnum, names in enumerate(it):
name = '_'.join(str(x) for x in names if x)
Expand Down
Loading