UnboundLocalError: local variable 'style_properties' referenced before assignment
Created originally on Bitbucket by ronbanks (ron banks)
I think this is a bug but so far I can't figure out why it fails. I create a file, save it, and then attempt to load_workbook and it fails with the reference before assignment error. If I manually open the file and Save As and overwrite the file, then the load_workbook works.
If I step through the load_workbook function from site-packages/openpyxl/reader/excel.py the code works. I'm sure I'm missing something but I am not yet familiar enough with the code to troubleshoot it. Here is an example script and an attached file that it fails to load:
#!python
from openpyxl import Workbook
import os
targetfile = os.path.join(os.getcwd(), 'test.xlsx')
wb = Workbook()
wb.save(filename = targetfile)
from openpyxl import load_workbook
wb = load_workbook(targetfile)
wb.save(filename = targetfile)
Attachments: test.xlsx