保存Excel工作簿时使用openpyxl:KeyError:'。mpo'

时间:2017-06-08 20:23:21

标签: python excel openpyxl

我编写了一个基本脚本来打开现有的.xlsx工作簿,并将图片添加到我本地驱动器的某些单元格中。它适用于大多数图片。但是,对于我得到的一张照片:

  File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site
    packages\openpyxl\workbook\workbook.py", line 345, in save
    save_workbook(self, filename)
    File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-
    packages\openpyxl\writer\excel.py", line 266, in save_workbook
    writer.save(filename)
    File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-
    packages\openpyxl\writer\excel.py", line 248, in save
    self.write_data()
    File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-
    packages\openpyxl\writer\excel.py", line 98, in write_data
    self.manifest._write(archive, self.workbook)
    File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-
    packages\openpyxl\packaging\manifest.py", line 171, in _write
    self._register_mimetypes(filenames=archive.namelist())
    File "C:\Users\Alex\AppData\Local\Programs\Python\Python36-32\lib\site-
    packages\openpyxl\packaging\manifest.py", line 183, in 
    _register_mimetypes
    mime = mimetypes.types_map[ext]
    KeyError: '.mpo'

任何人都可以帮我理解这个错误的含义吗?感谢

0 个答案:

没有答案