-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when loading DataTypes with the same name (different namespace). #1693
Comments
In our tests we load the machine vision cs opcua-asyncio/tests/test_xml.py Line 86 in af1b102
So this looks like a problem with the server. |
Hello @schroeder- , The test seems to be for server part. I am trying to connect as a client, and that is where the data type definitions fail. It seems that the problem comes from having a Structure with a field that is not one of the built-in data types. In the case BinaryIdBaseDataType has a field that is of TrimmedString which is a sup-type of string (also define in the same xml file). Checking the code in structures104.py ( I am no python expert btw) and it seems that it should work right ? specifically :
TrimmedString should be an alias for "String" so this should return true.. but somehow it does not. [Edited] Adding more information after some debugging. The server I am connecting has the latest base information model by the OPC Foundation. In that latest model they added a new data type also call TrimmedString. This is a case in which a companion specification defines something and then is move to the base standard. That means that in a server that use the latest version of the base standard + the machine vision companion specification there are two TrimmedString data types and this is where the bug is in the SDK. More specifically the problem is that the SDK (in _recursive_parse_basedatatypes function in structures104.py) is only checking names to see if a data type is already register (hasattr) which is not enough to individually identify a data type. Then when I try to load the the data types from the server the second TrimmedString from the machine vision companion spec is skip and when is referenced by the BinaryIdBaseDataType result in the failure/exception that I experience. How do I/we proceed with this ? should we just fix this function? this will kinda break a few things since you will not be able to just use ua.TrimmedString to create an instance of a data type. In this case both data types have the same meaning and are identical except on the node id. Maybe one possible solution would be to add something like a namespace, before loading the data types. In the examples there is this function register_namespace could be possible to expand it so that you provide an namespace for the data types in there ? So that you can then do something like :
Another options is also to expand load_data_type_definitions() with options to include the namespace information. Note that this probably will be a problem if two nodesets define a datatype with the same name, is not only a problem with the base information model and this particular data type TrimmedString. PS:I did also try to just import the xml file as a client but I get also an strange error "BadUserAccesDenied" and some other warnings. I also could not import it without setting strict mode to false. Not sure if the problem is also related to the one described here.
|
Hello,
I was testing the Client with an OPC UA server that implements OPC 40100-1: Machine Vision - Control, Configuration management, recipe management, result management
https://reference.opcfoundation.org/MachineVision/v100/docs/
NodeSet -> https://github.com/OPCFoundation/UA-Nodeset/tree/latest/MachineVision
The problem is that when I try to load the server data types (load_data_types_definitions() ) I get the following error:
This structure data type BinaryIdBaseDataType is an abstract and is the parent to other data types such as "ConfigurationIdDataType".
Since the exception mentions to report it here i am.
Python-Version: 3.11.4
opcua-asyncio Version 1.1.0
The text was updated successfully, but these errors were encountered: