FreeOpcUa / opcua-client-gui

OPC-UA GUI Client
GNU General Public License v3.0
524 stars 172 forks source link

AttributeError: module 'asyncua.ua' has no attribute 'Bit' #66

Open pierCartes opened 2 years ago

pierCartes commented 2 years ago

Hi, when i click on connect it provide me this error, server is running correctly, can someone identify this issue.

@dataclass class AccessRights:

'''
AccessRights structure autogenerated from xml
'''

Value:ua.ByteString = b''
ValidBits:ua.ByteString = b''

@dataclass class StructureWithOptionalFields:

'''
StructureWithOptionalFields structure autogenerated from xml
'''

OptionalInt32Specified:ua.Bit = ua.Bit()
OptionalStringArraySpecified:ua.Bit = ua.Bit()
Reserved1:ua.Bit = ua.Bit()
MandatoryInt32:ua.Int32 = 0
OptionalInt32:ua.Int32 = 0
MandatoryStringArray:List[ua.CharArray] = field(default_factory=list)
OptionalStringArray:List[ua.CharArray] = field(default_factory=list)

asyncua.common.structures - ERROR - Failed to execute auto-generated code from UA datatype:

@dataclass class StructureWithOptionalFields:

'''
StructureWithOptionalFields structure autogenerated from xml
'''

OptionalInt32Specified:ua.Bit = ua.Bit()
OptionalStringArraySpecified:ua.Bit = ua.Bit()
Reserved1:ua.Bit = ua.Bit()
MandatoryInt32:ua.Int32 = 0
OptionalInt32:ua.Int32 = 0
MandatoryStringArray:List[ua.CharArray] = field(default_factory=list)
OptionalStringArray:List[ua.CharArray] = field(default_factory=list)

') Traceback (most recent call last): File "C:\Python39\lib\site-packages\asyncua\common\structures.py", line 281, in _generate_python_class exec(code, env) File "", line 4, in File "", line 10, in StructureWithOptionalFields AttributeError: module 'asyncua.ua' has no attribute 'Bit' uawidgets.utils - ERROR - module 'asyncua.ua' has no attribute 'Bit'') Traceback (most recent call last): File "C:\Users\pierluigi.bandino\AppData\Roaming\Python\Python39\site-packages\uawidgets\utils.py", line 21, in wrapper result = func(self, args) File "C:\Users\pierluigi.bandino\Desktop\opcua-client-gui-master\uaclient\mainwindow.py", line 343, in connect self.uaclient.connect(uri) File "C:\Users\pierluigi.bandino\Desktop\opcua-client-gui-master\uaclient\uaclient.py", line 96, in connect self.client.load_type_definitions() File "C:\Python39\lib\site-packages\asyncua\sync.py", line 94, in wrapper result = self.tloop.post(aio_func(args, **kwargs)) File "C:\Python39\lib\site-packages\asyncua\sync.py", line 52, in post return futur.result() File "C:\Python39\lib\concurrent\futures_base.py", line 445, in result return self.get_result() File "C:\Python39\lib\concurrent\futures_base.py", line 390, in get_result raise self._exception File "C:\Python39\lib\site-packages\asyncua\client\client.py", line 662, in load_type_definitions return await load_type_definitions(self, nodes) File "C:\Python39\lib\site-packages\asyncua\common\structures.py", line 223, in load_type_definitions generator.get_python_classes(structs_dict) File "C:\Python39\lib\site-packages\asyncua\common\structures.py", line 177, in get_python_classes return _generate_python_class(self.model, env=env) File "C:\Python39\lib\site-packages\asyncua\common\structures.py", line 281, in _generate_python_class exec(code, env)

File "", line 4, in File "", line 10, in StructureWithOptionalFields AttributeError: module 'asyncua.ua' has no attribute 'Bit' uawidgets.utils - WARNING - Error class Window has no member show_error or error')

stikkx commented 2 years ago

Hi, i have the same error, any solution here ?

fcnjd commented 2 years ago

Hi, I'll join you two, since I also have the same error when connecting to the server opc.tcp://opcuaserver.com:48010/

oroulet commented 2 years ago

I pushed a fix to master so the uis does not crash. If your server does not support 1.04 you will be missing some custom types but it work