- это правильный способ создать собственное пространство имен?
- нужно ли мне это делать импортировать все XML-файлы в код Python в соответствии со спецификацией opcua-компаньона?
вот код:
async def main():
server = Server()
await server.init()
server.set_endpoint("opc.tcp://192.168.1.216:4000")
await server.import_xml("Opc.Ua.Nodeset2.xml")
await server.import_xml("Opc.Ua.Di.Nodeset2.xml")
await server.import_xml("Opc.Ua.Machinery.Nodeset2.xml")
await server.import_xml("Opc.Ua.Pumps.Nodeset2.xml")
await server.import_xml("testing_Nodeset.xml")
await server.start()
if __name__ == "__main__":
asyncio.run(main())```
here is the error i am getting :
AddNodesItem: Requested NodeId NodeId(Identifier=3062, NamespaceIndex=0, NodeIdType=) already exists
failure adding node NodeData(nodeid:NodeId(Identifier=3062, NamespaceIndex=0, NodeIdType=)) "The requested node id is already used by another node."(BadNodeIdExists)
Traceback (most recent call last):
File "c:\Users\user\OneDrive\Desktop\thesis\opcua\opc_server\opc_server\nodeset file testing\nodeset.py", line 50, in
asyncio.run(main())
File "C:\Program Files\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "c:\Users\user\OneDrive\Desktop\thesis\opcua\opc_server\opc_server\nodeset file testing\nodeset.py", line 40, in main
await server.import_xml("Opc.Ua.Nodeset2.xml")
File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\asyncua\server\server.py", li node = await self._add_node_data(nodedata, no_namespace_migration=True)
File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\asyncua\common\xmlimporter.py", line 228, in _add_node_data
node = await self.add_object(nodedata, no_namespace_migration)
File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\asyncua\common\xmlimporter.py", line 349, in add_object
res[0].StatusCode.check()
File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\asyncua\ua\uatypes.py", line 328, in check
raise UaStatusCodeError(self.value)
asyncua.ua.uaerrors._auto.BadNodeIdExists: "The requested node id is already used by another node."(BadNodeIdExists)
does anybody has an idea , how can this error be solved?
your advice and solution would be apreciated.
Подробнее здесь: https://stackoverflow.com/questions/764 ... -xml-files