[英]Win32com.client com_error
Today suddenly I am getting following error. 今天突然我得到以下错误。
import win32com.client
xl=win32com.client.Dispatch("Excel Application")
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
xl=win32com.client.Dispatch("Excel Application")
File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 108, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 85, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)
What is wrong? 怎么了?
It might be a little bit late for an anwser, but you are missing the dot between Excel and Application. 对于anwser来说可能有点晚了,但是您错过了Excel和Application之间的点。 "Excel.Application").
“ Excel.Application”)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.