You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And this way it worked fine. But after that I got this second error in the same file but line 254:
TypeError: this type has no size
attr = NotificationAttrib(sizeof(self.plc_type))
To let them work properly with at least the primitive types (I've tested just with them) I've changed the code in:
if attr is None: # when optional attr.Length is provided it works fine, telling PLC to monitor changes of primitive or structure up to size of the variable
if self.plc_type is not None: # this is provided with primitive types
attr = NotificationAttrib(sizeof(self.plc_type))
elif self.structure_def is not None: # because it is left None instead of self.symbol_type that is got from ADS, but seems to be just a string and no typedef is provided even if structure_def param has been provided
attr = NotificationAttrib(self._structure_size) # size has been set correctly
else: # I don't know if or when this can occur
attr = NotificationAttrib(1) # this should at least work, notification is set without error on a single byte subscription length (minimum length) and a warning message should be provided. Or other choices should be provided and least (alternatively to notification(1) or as last chance should be raised an exception
import warnings
warnings.warn("No plc_type found for symbol notification with length 1 is used.")
# raise ValueError('No plc_type found for symbol notification. Len value cannot be retrieved') # use instead of notification(1)+warning.warn()
This way, it seems me that primitives and structures works fine.
What did I wrong or is there something to improve?
The text was updated successfully, but these errors were encountered:
I've tried to read this simple structure:
Using Symbols:
Reading and writing works fine. But when i try to use Notification:
I've got a first error, and when found where and why, and solved, a second error.
The first error reports line 138 of symbol.py with error:
TypeError: unsupported operand type(s) for *: 'set' and 'int'
To let it work properly I had to change it in:
And this way it worked fine. But after that I got this second error in the same file but line 254:
TypeError: this type has no size
To let them work properly with at least the primitive types (I've tested just with them) I've changed the code in:
This way, it seems me that primitives and structures works fine.
What did I wrong or is there something to improve?
The text was updated successfully, but these errors were encountered: