1、
File "C:\Python26\Lib\site-packages\win32com\client\dynamic.py", line 78, in _
GetGoodDispatch7\xd6\xb7\xfb\xb4\xae', None, None)
办法:查看是否正确安装了EXCEL
2、
>>> import win32com.client >>> xlsApp = win32com.client.Dispatch('Excel.Application') >>> xlsApp.Workbooks.Open(r'D:/test.xls')
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<COMObject <unknown>>", line 8, in Open pywintypes.com_error: (-2147352567, '\xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3', (0, u'Microsoft Office Excel', u'\u540d\u4e3a\u201ctest.xls\u201d\u7684\u6587\u6 863\u5df2\u7ecf\u6253\u5f00\u3002\u4e0d\u80fd\u540c\u65f6\u6253\u5f00\u540c\u540 d\u6587\u4ef6\uff0c\u65e0\u8bba\u5b83\u4eec\u662f\u5426\u5728\u540c\u4e00\u6587\ u4ef6\u5939\u4e2d\u3002\n\u8981\u6253\u5f00\u7b2c\u4e8c\u4efd\u6587\u6863\uff0c\ u8bf7\u5173\u95ed\u5df2\u7ecf\u6253\u5f00\u7684\u6587\u6863\uff0c\u6216\u8005\u9 1cd\u65b0\u547d\u540d\u5176\u4e2d\u7684\u4e00\u4e2a\u6587\u6863\u3002', None, 0, -2146827284), None) 办法:查看文件是否存在 参考文献:http://stackoverflow.com/questions/7544587/why-is-the-information-for-pywintypes-com-error-unreadable
3、
book = xlrd.open_workbook(filename)
File "F:\helium2.1\lib\xlrd\__init__.py", line 370, in open_workbook
biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
File "F:\helium2.1\lib\xlrd\__init__.py", line 1323, in getbof
raise XLRDError('Expected BOF record; found 0x%04x' % opcode)
XLRDError: Expected BOF record; found 0x4b50
办法:xlrd只支持‘xls’文件。不支持office2007
If you upgrade to the latest version (0.7.0) of xlrd (go to
http://pypi.python.org/pypi/xlrd), you'd get a slightly better error
message:
Unsupported format, or corrupt file: Expected BOF record; found
'PK\x03\x04\x14\x00\x06\x00'
Trivium: 'PK' == initials of Phil Katz, designer of the ZIP file format.
Currently, xlrd supports reading only xls files. What you have is
probably an xlsm file ("Excel 2007 Macro-Enabled Workbook"). These and
xlsx files ("Excel 2007 Workbook") are in a format (XML documents inside
a ZIP file) that's totally different to the format of xls files.
Support for extracting the basic data (no formatting info) from xlsx and
xlsm files is well under way.
参考文献:http://groups.google.com/group/python-excel/msg/d956350b65498140?dmode=source