opcua-client-gui icon indicating copy to clipboard operation
opcua-client-gui copied to clipboard

connect OPCUA Server ERROR:raise RuntimeError(f"Unknown datatype for field: {sfield} in structure:{struct_name}, please report")

Open stan1334 opened this issue 3 years ago • 9 comments

ERROR:raise RuntimeError(f"Unknown datatype for field: {sfield} in structure:{struct_name}, please report")

full log: uaclient.uaclient - INFO - Connecting to opc.tcp://localhost:48010 with parameters None, None, None, None') uaclient.mainwindow - WARNING - showing error: %s') uawidgets.utils - ERROR - Unknown datatype for field: StructureField(Name='Value', Description=LocalizedText(Locale=None, Text=None), DataType=NodeId(Identifier=40016, NamespaceIndex=10, NodeIdType=<NodeIdType.FourByte: 1>), ValueRank=-1, ArrayDimensions=[], MaxStringLength=0, IsOptional=False) in structure:MessageData, please report') Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\uawidgets\utils.py", line 21, in wrapper result = func(self, *args) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\uaclient\mainwindow.py", line 354, in connect self.uaclient.connect(uri) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\uaclient\uaclient.py", line 126, in connect self.client.load_data_type_definitions() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\asyncua\sync.py", line 94, in wrapper result = self.tloop.post(aio_func(*args, **kwargs)) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\asyncua\sync.py", line 52, in post return futur.result() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\concurrent\futures_base.py", line 432, in result return self.__get_result() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\concurrent\futures_base.py", line 384, in __get_result raise self._exception File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\asyncua\client\client.py", line 685, in load_data_type_definitions return await load_data_type_definitions(self, node, overwrite_existing=overwrite_existing) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\asyncua\common\structures104.py", line 356, in load_data_type_definitions env = await _generate_object(dts.name, dts.sdef, data_type=dts.data_type) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\asyncua\common\structures104.py", line 274, in _generate_object code = make_structure_code(data_type, name, sdef) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\asyncua\common\structures104.py", line 199, in make_structure_code raise RuntimeError(f"Unknown datatype for field: {sfield} in structure:{struct_name}, please report") RuntimeError: Unknown datatype for field: StructureField(Name='Value', Description=LocalizedText(Locale=None, Text=None), DataType=NodeId(Identifier=40016, NamespaceIndex=10, NodeIdType=<NodeIdType.FourByte: 1>), ValueRank=-1, ArrayDimensions=[], MaxStringLength=0, IsOptional=False) in structure:MessageData, please report uaclient.mainwindow - WARNING - showing error: %s')

stan1334 avatar Jun 02 '22 07:06 stan1334

@oroulet @CuriousCrook what datatype from log,please guid me how to connect。

stan1334 avatar Jun 02 '22 07:06 stan1334

I once had a similar error, but didn't have time to investigate it further at the time. At that time it seemed that the client would not support custom structures within structures.

Do you have the possibility to reproduce the problem with the Python server? If you have a NodeSet2.xml for the problematic types, you could load it in a sample server and connect the GUI client to it. If the error is then reproducible, that would be super handy for us to investigate the problem further.

CuriousCrook avatar Jun 02 '22 08:06 CuriousCrook

@CuriousCrook thank U for reply,uaexpert can connect UA Server success by this models。 models XML INFO,this datetypes include on opcua C/C++, my server by C/C++ SDK dev。 OS:Win 10 Interl5/X64

urn:inovance:rtdb:ns-1001 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i=10 i=11 i=12 i=13 i=14 i=15 i=16 i=17 i=18 i=19 i=20 i=21 i=22 i=23 i=24 i=25 i=26 i=27 i=28 i=29 i=30 i=35 i=37 i=40 i=45 i=46 i=47 i=294 i=296 i=884 i=887 i=2000 i=2001 i=2002 i=2003 i=8912 varGroup0 ns=10;i=61 i=85 TEST_EXTERNAL_G0_L1_1_0 描述信息 ns=10;i=2002 ns=1001;s=varGroup0 VariableCfgs ns=10;i=3001 10 20 Description1 Description2 0 1 message 0 message 1 TEST_EXTERNAL_G0_L1_1_0 TEST_EXTERNAL_G0_L1_1_0 TEST_EXTERNAL_G0_L1_1_0 TEST_EXTERNAL_G0_L1_1_0 TEST_EXTERNAL_G0_L1_1_0.label ns=10;i=2005 ns=20;s=links1 ns=1001;s=TEST_EXTERNAL_G0_L1_1_0 AlarmCfgs ns=10;i=3002

stan1334 avatar Jun 02 '22 08:06 stan1334

I fix a lot of problems with structs in this pull request: https://github.com/FreeOpcUa/opcua-asyncio/pull/901 maybe you can test it.

schroeder- avatar Jun 02 '22 10:06 schroeder-

I fix a lot of problems with structs in this pull request: FreeOpcUa/opcua-asyncio#901 maybe you can test it. asyncua/ua/uatypes.py file is 最新的 asyncua/common/structures104.py allpath is C:\Users\Administrator\AppData\Local\Programs\Python\Python37\Lib\site-packages\asyncua\common\structures104.py, I made a replacement。

@schroeder

python 3.7.0rc1 OS win10 64 48010 server :C++ OPCua opcua-asyncio:0.9.94

image

stan1334 avatar Jun 06 '22 02:06 stan1334

The fix is not released yet. You must clone asyncua from current master and install it via pip install .

schroeder- avatar Jun 06 '22 09:06 schroeder-

e/opcuapythonTest/opcua-client-gui

507 pip uninstall asyncua opcua-client 508 pip install . 510 opcua-client same err: uaclient.uaclient - INFO - Connecting to opc.tcp://localhost:48010 with parameters None, None, None, None') uaclient.mainwindow - WARNING - showing error: %s') uawidgets.utils - ERROR - Unknown datatype for field: StructureField(Name='Value', Description=LocalizedText(Locale=None, Text=None), DataType=NodeId(Identifier=40016, NamespaceIndex=10, NodeIdType=<NodeIdType.FourByte: 1>), ValueRank=-1, ArrayDimensions=[], MaxStringLength=0, IsOptional=False) in structure:MessageData, please report') Traceback (most recent call last): File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\uawidgets\utils.py", line 21, in wrapper result = func(self, *args) File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\uaclient\mainwindow.py", line 354, in connect self.uaclient.connect(uri) File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\uaclient\uaclient.py", line 126, in connect self.client.load_data_type_definitions() File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\asyncua\sync.py", line 94, in wrapper result = self.tloop.post(aio_func(*args, **kwargs)) File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\asyncua\sync.py", line 52, in post return futur.result() File "c:\users\administrator\appdata\local\programs\python\python37\lib\concurrent\futures_base.py", line 432, in result return self.__get_result() File "c:\users\administrator\appdata\local\programs\python\python37\lib\concurrent\futures_base.py", line 384, in __get_result raise self._exception File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\asyncua\client\client.py", line 685, in load_data_type_definitions return await load_data_type_definitions(self, node, overwrite_existing=overwrite_existing) File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\asyncua\common\structures104.py", line 356, in load_data_type_definitions env = await _generate_object(dts.name, dts.sdef, data_type=dts.data_type) File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\asyncua\common\structures104.py", line 274, in _generate_object code = make_structure_code(data_type, name, sdef) File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\asyncua\common\structures104.py", line 199, in make_structure_code raise RuntimeError(f"Unknown datatype for field: {sfield} in structure:{struct_name}, please report") RuntimeError: Unknown datatype for field: StructureField(Name='Value', Description=LocalizedText(Locale=None, Text=None), DataType=NodeId(Identifier=40016, NamespaceIndex=10, NodeIdType=<NodeIdType.FourByte: 1>), ValueRank=-1, ArrayDimensions=[], MaxStringLength=0, IsOptional=False) in structure:MessageData, please report uaclient.mainwindow - WARNING - showing error: %s')

@schroeder

stan1334 avatar Jun 07 '22 02:06 stan1334

You don't need to update opcua-client, you need to install the current master from asyncio: https://github.com/FreeOpcUa/opcua-asyncio.git

schroeder- avatar Jun 07 '22 06:06 schroeder-

You don't need to update opcua-client, you need to install the current master from asyncio: https://github.com/FreeOpcUa/opcua-asyncio.git

realy realy cannot connect,python not support C/CXX some base type

stan1334 avatar Jun 07 '22 07:06 stan1334