Python Win32 COM分派32位版本的TestStand

Python Win32 COM分派32位版本的TestStand,python,com,dispatch,teststand,Python,Com,Dispatch,Teststand,我有一个python脚本,它连接到TestStand并从.seq(sequence)文件中检索某些数据 我已经安装了Test Stand 2014的x32和x64版本,脚本运行得很好。 卸载x64版本后(因为不需要),脚本现在会出现以下错误: Traceback (most recent call last): File "C:\ts\Main.py", line 9, in <module> TestStandEngine = win32com.client.Dispa

我有一个python脚本,它连接到TestStand并从.seq(sequence)文件中检索某些数据

我已经安装了Test Stand 2014的x32和x64版本,脚本运行得很好。 卸载x64版本后(因为不需要),脚本现在会出现以下错误:

Traceback (most recent call last):
  File "C:\ts\Main.py", line 9, in <module>
    TestStandEngine = win32com.client.Dispatch("TestStand.Engine")
  File "C:\LegacyApp\Python_2.7\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\LegacyApp\Python_2.7\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\LegacyApp\Python_2.7\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)
-我的计算机上唯一安装的测试台是32位版本

-操作系统:Windows x64位操作系统

以下是我的猜测:我认为当它分派Teststand.Engine时,它会尝试使用不再安装的x64版本; 我尝试添加clsctx参数,但结果相同:

win32com.client.Dispatch("TestStand.Engine",clsctx=pythoncom.CLSCTX_LOCAL_SERVER)
有没有办法“强制”它启动32位版本?如果TestStand是32位的,而Python是32位的,那么它不应该返回一个32位的COM对象,该对象应该与python32位一起工作吗


更新:因此,在PowerShell中运行后,它返回了COM的所有有效名称列表,但“Teststand.Engine”不在列表中。列表中唯一与TestStand相关的对象是TestStand.ExLauncher(我可以分派它,但它没有与TestStand.Engine相同的属性/用途)。通过重新安装TestStand解决了这个问题。(我知道重新安装可以解决问题,但我希望我不必重新安装它,因为它会影响多个配置)

问题是,当我卸载TestStand x64版本时,卸载程序认为我将完全卸载TestStand,并且很可能删除了一些包含“TestStand.Engine”说明的注册表项
重新安装x32位版本后,它工作正常。

您是否尝试过使用版本相关接口来代替ie

TestStandEngine = win32com.client.Dispatch("TestStand.Engine.1")

您好。感谢您的回复。不,当时我认为我没有尝试过。我有很多COM对象都使用了此功能,唯一出现的TestStand与TestStand.Engine无关。问题已通过重新安装TestStand得到解决。再次感谢您的建议:)
win32com.client.Dispatch("TestStand.Engine",clsctx=pythoncom.CLSCTX_LOCAL_SERVER)
TestStandEngine = win32com.client.Dispatch("TestStand.Engine.1")