用python代码连接SchneiderAut.OFS.2

2024-10-01 00:15:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在使用OpenOPC库连接施耐德Aut.OFS.2 OPC服务器

导入OpenOPC

opc=OpenOPC.client()

opc.servers()

['Schneider-Aut.OFS.2','Matrikon.OPC.Simulation.1'] 它与Matrikon.OPC.Simulation.1连接,但当我尝试与Schneider Aut.OFS.2连接时出现以下错误 opc.connect('Schneider-Aut.OFS.2') 错误消息

opc.connect('Schneider-Aut.OFS.2') Traceback (most recent call last): File "C:\Users\alraza\AppData\Local\Programs\Python\Python39-32\lib\site-packages\OpenOPC.py", line 223, in connect self._opc.Connect(s, opc_host) File "C:\Users\alraza\AppData\Local\Programs\Python\Python39-32\lib\site-packages\win32com\gen_py\F8582D24-88FB-11D0-B850-00C0F0104305x0x1x0.py", line 207, in Connect return self.oleobj.InvokeTypes(1610743826, LCID, 1, (24, 0), ((8, 1), (12, 17)),ProgID pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, 'Class not registered\r\n', None, 0, -2147221164), None)

在处理上述异常期间,发生了另一个异常:

回溯(最近一次呼叫最后一次): 文件“”,第1行,在 文件“C:\Users\alraza\AppData\Local\Programs\Python\Python39-32\lib\site packages\OpenOPC.py”,第227行,在connect中 raise OPCEROR(错误消息) OpenOPC.OPCError:连接:-2147221164

我甚至尝试添加Schneider Aut.OFS.2 OpenOPC.py库,但没有成功

提前谢谢


Tags: pyliblocalconnect错误usersappdataprograms