Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 使用opc-ua-Python编写一个值_Python 3.x_Opc - Fatal编程技术网

Python 3.x 使用opc-ua-Python编写一个值

Python 3.x 使用opc-ua-Python编写一个值,python-3.x,opc,Python 3.x,Opc,我尝试使用以下示例编写值: 但我有一个错误: Exception "unhandled opcua.ua.uaerrors._auto.BadTypeMismatch" "The value supplied for the attribute is not of the same type as the attribute"s value."(BadTypeMismatch) File: C:\Users\lari\AppData\Loca

我尝试使用以下示例编写值:

但我有一个错误:

 Exception "unhandled opcua.ua.uaerrors._auto.BadTypeMismatch"
"The value supplied for the attribute is not of the same type as the attribute"s value."(BadTypeMismatch)
File: C:\Users\lari\AppData\Local\Programs\Python\Python38\lib\site-packages\opcua\ua\uatypes.py, Line: 218
有人能帮我吗


非常感谢

这告诉您服务器期望的数据类型与您编写的数据类型不同。

我发现\o/

此链接帮助我:

我希望我的冒险能帮助别人;)

dv = ua.DataValue(ua.Variant(122, ua.VariantType.Int32))
dv.ServerTimestamp = None
dv.SourceTimestamp = None
trou.set_value(dv)