当我使用OpenOpc运行opc.write()时,Python脚本崩溃

2024-06-28 15:00:09 发布

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

我正在制作一个python程序,将变量写入OPCDA服务器

我和其他人有联系,但当我尝试写值时​​对于变量,程序不响应,并显示windows错误消息,说明:

this is the error i recive

我的代码:

导入OpenOPC 导入系统

opc = OpenOPC.client()
servers = opc.servers()

idServer = int(2)
print('connecting to opc server:', servers[idServer])
opc.connect(servers[idServer])
print('connection okey:', servers[idServer])

write = opc.write(('variableName', 1))
print('write:', write)
input('> ')

有人知道程序到达该部分时为何崩溃吗?非常感谢


Tags: 代码程序服务器消息windows系统错误write