openpyxl+load_workbook+AttributeError: 'NoneType' object has no attribute 'date1904'
Created originally on Bitbucket by mikewolfli (Wei Li)
Hello, several months before, i met this problem , when i use the openpyxl to load a xlsx file which was created by another sys. When I put it on stackoverflow, there had no reply. So i debug it by myself, at last found that : in xlsx's property, the properties is nothing . According this, i changed the file "openpyxl / openpyxl / packaging / workbook.py": class WorkbookParser:
def init(self, archive): self.archive = archive self.wb = Workbook() self.sheets =  self.rels = get_dependents(self.archive, ARC_WORKBOOK_RELS)
def parse(self): src = self.archive.read(ARC_WORKBOOK) node = fromstring(src) package = WorkbookPackage.from_tree(node)
if package.properties is not None: #add this line if package.properties.date1904: wb.excel_base_date = CALENDAR_MAC_1904 self.wb.code_name = package.properties.codeName
self.wb.active = package.active
The problem is solved. At last ,I pull a request to change it .
The question in stackoverflow is here: http://stackoverflow.com/questions/38967587/openpyxlload-workbookattributeerror-nonetype-object-has-no-attribute-date1/39324285?noredirect=1#comment69055961_39324285