Saving this workbook fails

Issue #1197 resolved created an issue

Opening this sheet as not read-only and saving it fails reliably. Worked with a previous version.

import openpyxl

fname = "sheets/subjects_xlsx/01sumdat.xlsx"
outname = "testme.xlsx"

workbook = openpyxl.load_workbook(filename=fname, read_only=False)
$ python 
Traceback (most recent call last):
  File "", line 7, in <module>
  File "/Users/emery/anaconda3/lib/python3.7/site-packages/openpyxl/workbook/", line 396, in save
    save_workbook(self, filename)
  File "/Users/emery/anaconda3/lib/python3.7/site-packages/openpyxl/writer/", line 294, in save_workbook
  File "/Users/emery/anaconda3/lib/python3.7/site-packages/openpyxl/writer/", line 276, in save
  File "/Users/emery/anaconda3/lib/python3.7/site-packages/openpyxl/writer/", line 76, in write_data
  File "/Users/emery/anaconda3/lib/python3.7/site-packages/openpyxl/writer/", line 216, in _write_worksheets
  File "/Users/emery/anaconda3/lib/python3.7/site-packages/openpyxl/writer/", line 201, in write_worksheet
  File "/Users/emery/anaconda3/lib/python3.7/site-packages/openpyxl/worksheet/", line 357, in write
  File "/Users/emery/anaconda3/lib/python3.7/site-packages/openpyxl/worksheet/", line 345, in write_tail
  File "/Users/emery/anaconda3/lib/python3.7/site-packages/openpyxl/worksheet/", line 241, in write_breaks
AttributeError: 'tuple' object has no attribute 'to_tree'

My code (not this piece) is now failing on 16 other spreadsheets it previously worked on, and I suspect the problem is the same.

Comments (5)

  1. CharlieC

    Thanks for the report. I'd already come across this but the current fix doesn't solve all the problems.

  2. CharlieC

    Yeah, the problem is related to handling colBreaks as well as rowBreaks and then a typo in the dispatcher. Will be checking in a fix fairly shortly.

  3. reporter

    Are you sure #1203 is a duplicate? It looks like a different error (but if it's a dupe and it'll be fixed soon, great!)

  4. Log in to comment