Crash when writing an empty row in Excel sheet

Issue #398 resolved
David Laudy created an issue


I have a crash when trying to write an empty row between non empty rows.

The following code snippets shows the problem.

import openpyxl
import os

workbook = openpyxl.workbook.Workbook(optimized_write=True)
sheet = workbook.create_sheet()
sheet.title = u'hello'
sheet.append(['1', '2', '3'])
sheet.append(['4', '5']), 'test_empty_rows.xlsx'))

I am running openpyxl 2.1 with lxml.

The traceback I get is

Traceback (most recent call last):
  File "", line 9, in <module>
  File "C:\data\workspace\pylos\openpyxl\writer\", line 132, in append
    self._max_col = max(self._max_col, col_idx)
UnboundLocalError: local variable 'col_idx' referenced before assignment

Thanks to have a look.


Comments (5)

  1. Log in to comment