"There is no item named 'xl/drawings/drawing1.xml' in the archive"

Issue #1125 on hold
Mikela Clemmons
created an issue

I'm trying to load in a xlxs file generated by Excel and am getting this error. As far as i can tell there are no actual drawings of anything in the spreadsheet but after unzipping the file and grepping through the xml I found multiple references to the drawings that are not part of the archive.

It seems excel has some bad behavior. Does openpyxl have an ignore missing files option? Could one be added?

~/anaconda3/envs/data_warehouse/lib/python3.7/site-packages/openpyxl/reader/excel.py in load_workbook(filename, read_only, keep_vba, data_only, guess_types, keep_links)
    273                 drawings = rels.find(SpreadsheetDrawing._rel_type)
    274                 for rel in drawings:
--> 275                     charts, images = find_images(archive, rel.target)
    276                     for c in charts:
    277                         ws.add_chart(c, c.anchor)

~/anaconda3/envs/data_warehouse/lib/python3.7/site-packages/openpyxl/reader/drawings.py in find_images(archive, path)
     21     """
     22 
---> 23     src = archive.read(path)
     24     tree = fromstring(src)
     25     try:

~/anaconda3/envs/data_warehouse/lib/python3.7/zipfile.py in read(self, name, pwd)
   1426     def read(self, name, pwd=None):
   1427         """Return file bytes (as a string) for name."""
-> 1428         with self.open(name, "r", pwd) as fp:
   1429             return fp.read()
   1430 

~/anaconda3/envs/data_warehouse/lib/python3.7/zipfile.py in open(self, name, mode, pwd, force_zip64)
   1465         else:
   1466             # Get info object for name
-> 1467             zinfo = self.getinfo(name)
   1468 
   1469         if mode == 'w':

~/anaconda3/envs/data_warehouse/lib/python3.7/zipfile.py in getinfo(self, name)
   1393         if info is None:
   1394             raise KeyError(
-> 1395                 'There is no item named %r in the archive' % name)
   1396 
   1397         return info

KeyError: "There is no item named 'xl/drawings/drawing1.xml' in the archive"

Comments (3)

  1. Log in to comment