python对excel操作 com_error错误
来源:互联网 发布:ps cs6色环插件 mac 编辑:程序博客网 时间:2024/06/16 00:36
1、
File "C:\Python26\Lib\site-packages\win32com\client\dynamic.py", line 78, in _
GetGoodDispatchIDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.II
D_IDispatch)
pywintypes.com_error: (-2147221005, '\xce\xde\xd0\xa7\xb5\xc4\xc0\xe0\xb1\xf0\xd
7\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 Openpywintypes.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\u6863\u5df2\u7ecf\u6253\u5f00\u3002\u4e0d\u80fd\u540c\u65f6\u6253\u5f00\u540c\u540d\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\u91cd\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
- python对excel操作 com_error错误
- python对excel操作
- python 对excel操作
- Python对EXCEL的操作
- python对excel的操作
- Python 对Excel操作读写
- python中对Excel进行读写操作
- Python对Excel的操作 pyExcelerator
- python中对Excel进行读写操作
- python 对EXCEL的读写操作
- 使用Python对Excel进行读写操作
- Python xlrd/xlwt对excel进行操作
- python中对excel的操作
- python对excel文件的读写操作
- python对excel文件进行操作
- python 对 Excel 的文件操作
- 使用python对txt,excel批量操作
- python 对excel操作用法详解
- MASM 和 Turbo C 2.0 混合编程
- IE/FF表单回车自动提交的问题
- 本人热衷于的小米手机配置和图片,给大家参考一下哦----zhoudianzhang
- javascript cookie应用保存登录的用户名和密码源码实例
- 安装Tomcat的具体步骤
- python对excel操作 com_error错误
- Excel的简单使用
- js的变量作用域
- android布局文件属性说明(转)
- http错误码整理
- Spring的LocalSessionFactoryBean类(转)
- centos/linux安装中文输入法
- mocks 代理工具
- Yii修炼宝典