Test Failed
Push — dev ( 6735ce...a45986 )
by Olivier
02:03 queued 14s
created

examples.SubHandler.status_change_notification()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 2
rs 10
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()
31