handle an empty data set
This commit is contained in:
parent
216079ee59
commit
b8f3ad548d
|
@ -32,7 +32,11 @@ class TableLister(ListFormatter):
|
|||
# first row and set the alignment of the
|
||||
# output accordingly.
|
||||
data_iter = iter(data)
|
||||
try:
|
||||
first_row = next(data_iter)
|
||||
except StopIteration:
|
||||
pass
|
||||
else:
|
||||
for value, name in zip(first_row, column_names):
|
||||
alignment = self.ALIGNMENTS.get(type(value), 'l')
|
||||
x.set_field_align(name, alignment)
|
||||
|
|
Loading…
Reference in New Issue