client_deleting.py
Go to the documentation of this file.
1 import sys
2 sys.path.insert(0, "..")
3 import logging
4 
5 from opcua import Client
6 from opcua import ua
7 
8 
9 if __name__ == "__main__":
10  logging.basicConfig(level=logging.WARN)
11 
12  client = Client("opc.tcp://admin@localhost:4840/freeopcua/server/") #connect using a user
13  try:
14  client.connect()
15 
16  objects = client.get_objects_node()
17  folder = objects.add_folder("ns=2;i=3007", "2:Folder1")
18  var = folder.add_variable("ns=2;i=3008", "2:Variable1", 3.45)
19  # Now getting a variable node using its browse path
20  var.set_value(9.89) # just to check it works
21 
22  results = client.delete_nodes([folder, var])
23  try:
24  #var.set_value(9.89) # just to check it does not work
25  var.get_browse_name()
26  except ua.UaStatusCodeError:
27  print("The variable has been removed OK")
28 
29  finally:
30  client.disconnect()


ros_opcua_impl_python_opcua
Author(s): Denis Štogl , Daniel Draper
autogenerated on Tue Jan 19 2021 03:12:43