You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to read all cells in this table, an exception is thrown:
from docx import Document
with open('broken_table.docx', 'rb') as fh:
document = Document(fh)
print([cell.text for cell in document.tables[0].rows[0].cells])
Traceback (most recent call last):
File "./broken_table.py", line 5, in <module>
print([cell.text for cell in document.tables[0].rows[0].cells])
File "./venv/lib/python3.6/site-packages/docx/table.py", line 384, in cells
return tuple(self.table.row_cells(self._index))
File "./venv/lib/python3.6/site-packages/docx/table.py", line 106, in row_cells
return self._cells[start:end]
File "./venv/lib/python3.6/site-packages/docx/table.py", line 173, in _cells
cells.append(cells[-col_count])
IndexError: list index out of range
We are using version 0.8.6 with Python 3.6 and the error occurs on Linux and macOS.
The text was updated successfully, but these errors were encountered:
Hey there,
we stumbled upon a strange docx file in production.
broken_table.docx
When trying to read all cells in this table, an exception is thrown:
We are using version 0.8.6 with Python 3.6 and the error occurs on Linux and macOS.
The text was updated successfully, but these errors were encountered: