首页 > 解决方案 > 用 python 代码连接 Schneider-Aut.OFS.2

问题描述

我目前正在使用 OpenOPC 库连接 Schneider-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 连接时出现以下错误。连接('Schneider-Aut.OFS.2') 错误信息

opc.connect('Schneider-Aut.OFS.2') Traceback(最近一次调用最后):文件“C:\Users\alraza\AppData\Local\Programs\Python\Python39-32\lib\site-packages\OpenOPC .py”,第 223 行,在连接 self._opc.Connect(s, opc_host) 文件“C:\Users\alraza\AppData\Local\Programs\Python\Python39-32\lib\site-packages\win32com\gen_py\ F8582D24-88FB-11D0-B850-00C0F0104305x0x1x0.py",第 207 行,在 Connect 中返回 self。oleobj .InvokeTypes(1610743826, LCID, 1, (24, 0), ((8, 1), (12, 17)),ProgID pywintypes.com_error: (-2147352567, '发生异常。', (0, None, '类未注册\r\n', 无, 0, -2147221164), 无)

在处理上述异常的过程中,又出现了一个异常:

回溯(最后一次调用):文件“”,第 1 行,在文件“C:\Users\alraza\AppData\Local\Programs\Python\Python39-32\lib\site-packages\OpenOPC.py”中,第 227 行, 在连接中引发 OPCError(error_msg) OpenOPC.OPCError: Connect: -2147221164

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

提前致谢

标签: pythonopcopc-da

解决方案


推荐阅读