python无法识别已注册的COM对象';s win32com.client.dispatch()

python无法识别已注册的COM对象';s win32com.client.dispatch(),python,com,win32com,Python,Com,Win32com,我正在尝试用Python加载COM对象。我正在使用win32com.client.Dispatch(“Name.Of.Object”)加载它,COM对象已在regsvr32中注册,并在HKLM/CLSID和HKLM/Wow6432Node/CLSID中显示为我的注册表中的一个条目。我可以使用VBScript很好地打开它,但是Python的win32com.client.Dispatch()给了我以下错误: Traceback (most recent call last): File "&l

我正在尝试用Python加载COM对象。我正在使用win32com.client.Dispatch(“Name.Of.Object”)加载它,COM对象已在regsvr32中注册,并在HKLM/CLSID和HKLM/Wow6432Node/CLSID中显示为我的注册表中的一个条目。我可以使用VBScript很好地打开它,但是Python的win32com.client.Dispatch()给了我以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  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)
pywintypes.com_error: (-2147221164, 'Class not registered', None, None)

谢谢

通过安装Python 64位和win32com 64位解决了这个问题。

有趣的是,对我来说,情况正好相反。移动到Python 32位为我修复了它。我运行的是64位Windows 10。
Set obj = WScript.CreateObject( "Name.Of.Object" )