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

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

Open pierCartes opened this issue 3 years ago • 3 comments

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')

pierCartes avatar Oct 18 '21 08:10 pierCartes

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

stikkx avatar Jan 18 '22 16:01 stikkx

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

fcnjd avatar Jan 28 '22 15:01 fcnjd

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

oroulet avatar Jan 28 '22 20:01 oroulet