我正在尝试通过win32.com连接API,这是代码:
import win32com.client
ge = win32com.client.Dispatch('GoogleEarth.Application')
但收到以下错误:
Traceback (most recent call last):
File "D:\Python34\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/Python34/GEtest6.py", line 3, in <module>
ge = win32com.client.Dispatch('GoogleEarth.Application')
File "D:\Python34\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "D:\Python34\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "D:\Python34\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
我已经尝试了很长时间,并且已经使用了许多方法但从未工作过。它真的让我发疯。我的朋友已经使用VS2010的MFC制作了Google Earth APP。所以我想知道是否有任何办法通过Python连接GE API ...