我需要使用win32com远程连接到两台仪器,但在创建第二个对象时出现错误。代码如下所示:
scope1 = win32com.client.Dispatch("LeCroy.ActiveDSOCtrl.1") #creates first instance of the ActiveDSO control
scope1.MakeConnection("GPIB:5") #Connects to device via GPIB
scope2 = win32com.client.Dispatch("LeCroy.ActiveDSOCtrl.2") #creates a second instance of the ActiveDSO control
scope2.MakeConnection("IP:127.0.0.1") #Connects to the oscilloscope on local host我在第二次创建COM对象时遇到错误。如果可能的话,有谁知道如何让它工作吗?
发布于 2017-08-01 02:50:30
为了方便其他远程控制仪器,解决方案比预期的要简单: scope1 = win32com.client.Dispatch("LeCroy.ActiveDSOCtrl.1") #创建ActiveDSO控件的第一个实例
win32com.client.Dispatch("LeCroy.ActiveDSOCtrl.1") (“GPIB :5”)#通过GPIB连接到设备#创建ActiveDSO控件的第二个实例
other e2.MakeConnection(“IP :127.0.0.1”)#连接到本地主机或任何其他IP地址上的示波器
实际上,我可以创建任意多的activEx对象,只要我在分派中使用相同的引用:"LeCroy.ActiveDSOCtrl.1“
生成器= win32com.client.Dispatch("LeCroy.ActiveDSOCtrl.1")
multimeter= win32com.client.Dispatch("LeCroy.ActiveDSOCtrl.1")。。
我的错误是使用了没有引用的.2。
https://stackoverflow.com/questions/45373426
复制相似问题