Skip to content
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

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

Open
pierCartes opened this issue Oct 18, 2021 · 3 comments
Open

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

pierCartes opened this issue Oct 18, 2021 · 3 comments

Comments

@pierCartes
Copy link

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
Copy link

stikkx commented Jan 18, 2022

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

@fcnjd
Copy link

fcnjd commented Jan 28, 2022

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

@oroulet
Copy link
Member

oroulet commented Jan 28, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants