Skip to content

Commit

Permalink
fix to handle value = [] edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
fzumstein committed Oct 21, 2018
1 parent 6970932 commit c319959
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xlwings/conversion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def write(value, rng, options):
# Don't allow to write lists and tuples as jagged arrays as appscript and pywin32 don't handle that properly
# This should really be handled in Ensure2DStage, but we'd have to set the original format in the conversion
# ctx meta as the check should only run for list and tuples
if isinstance(value, (list, tuple)) and isinstance(value[0], (list, tuple)) and len(value) > 0:
if isinstance(value, (list, tuple)) and len(value) > 0 and isinstance(value[0], (list, tuple)):
first_row = value[0]
for row in value:
if len(first_row) != len(row):
Expand Down
1 change: 1 addition & 0 deletions xlwings/tests/test_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def test_jagged_array(self):
self.wb1.sheets[0].range('A1').value = [[1, 2], [1, 2]]
self.wb1.sheets[0].range('A1').value = [1, 2, 3]
self.wb1.sheets[0].range('A1').value = [[1, 2, 3]]
self.wb1.sheets[0].range('A1').value = []



Expand Down

0 comments on commit c319959

Please sign in to comment.