-
-
Notifications
You must be signed in to change notification settings - Fork 592
Closed
Description
I am trying to add additional column to a Dataset that is created from a dictionary. I have headers defined separately. However, when dictionary is empty (no rows to export because how data is filtered) insert_col method fails with error:
File "/usr/local/lib/python3.10/site-packages/tablib/core.py", line 372, in _clean_col
header = [col.pop(0)]
IndexError: pop from empty list
After looking in to the code of the method _clean_col, my guess, that if statement:
Lines 373 to 376 in 4fd9a68
| if self.headers: | |
| header = [col.pop(0)] | |
| else: | |
| header = [] |
should be opposite:
if not self.headers:
header = [col.pop(0)]
else:
header = []or:
if self.headers:
header = []
else:
header = [col.pop(0)]Metadata
Metadata
Assignees
Labels
No labels