Listing 7 shows example code of a PyOPC XDAClient-based client12that first retrieves the server status, browses the root item and reads an item:
Line 1 and 2 import the needed PyOPC modules. In Line 4 a simple function is defined that prints a list of ItemContainer objects (ilist) and the global options Python dictionary (Options).
In line 9, the client object is created: As global options, the server address is specified and ReturnErrorText = True denotes that the client requests verbose error descriptions.
Lines 12, 13 and 14 show the three different OPC operations. The return parameters of these operations are a list of ItemContainer objects and the global options (a Python dictionary), which are both handled by the function print_options.