Skip to content
Snippets Groups Projects
Commit d0f2f8de authored by Taya Snijder's avatar Taya Snijder
Browse files

Merge branch 'L2SS-343-remove-lofareu-namespace-hack' into 'master'

L2SS-343: Remove hack if  lofar.eu namespace doesn't exist

Closes L2SS-343

See merge request !122
parents fc5b86d7 98535568
No related branches found
No related tags found
1 merge request!122L2SS-343: Remove hack if lofar.eu namespace doesn't exist
......@@ -51,15 +51,12 @@ class OPCUAConnection(CommClient):
# determine namespace used
try:
if type(namespace) is str:
self.name_space_index = self.client.get_namespace_index(namespace)
elif type(namespace) is int:
self.name_space_index = namespace
except Exception as e:
self.streams.error_stream("Could not determine namespace index from namespace: %s: %s", namespace, e)
raise Exception("Could not determine namespace index from namespace %s", namespace) from e
if type(namespace) is str:
self.name_space_index = self.client.get_namespace_index(namespace)
elif type(namespace) is int:
self.name_space_index = namespace
else:
raise TypeError(f"namespace must be of type str or int, but is of type {type(namespace).__name__}")
self.obj = self.client.get_objects_node()
self.check_nodes()
......@@ -135,6 +132,9 @@ class OPCUAConnection(CommClient):
else:
raise Exception("OPC-ua mapping requires either a list of the path or dict with the path. Was given %s type containing: %s", type(annotation), annotation)
# prepend namespace index for each element if none is given
path = [name if ':' in name else f'{self.name_space_index}:{name}' for name in path]
try:
node = self.obj.get_child(path)
except Exception as e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment