Page 1 of 1

REL1100 Error Handler Callback Description Datatype

Posted: Sat Jun 25, 2022 6:31 pm
by jnbastoky
The description data type in the error handler for the REL110 will return different data types at different times. Sometimes I get a str. Other times it's bytes. It seems to alternate between the two

Here's the callback handler. I'm printing the data type of the description callback parameter to console. The API documentation says this should be a str. I don't care which, but it would be nice for it to be the same every call. :D

Code: Select all

def _error(self, channel, code, description):
        self.model.error_code = ErrorCode.getName(code)
        self.model.error_description = str(description)
        print(f'{self} Error!')
        print(f'    Code: {self.model.error_code}')
        print(f'    Description: {self.model.error_description} ({type(description)})')
Console

Code: Select all

serial 496796 / hub port 0 / ch 1 / digital out  (REL1100 (Solid-State Relay)): False @ 2022-06-25 19:52:19.338380+00:00 Error!
    Code: EPHIDGET_NOTATTACHED
    Description: b'Device not Attached' (<class 'bytes'>)
serial 496796 / hub port 0 / ch 1 / digital out  (REL1100 (Solid-State Relay)): False @ 2022-06-25 19:52:19.442655+00:00 Error!
    Code: EPHIDGET_NOTATTACHED
    Description: Device not Attached (<class 'str'>)


Re: REL1100 Error Handler Callback Description Datatype

Posted: Mon Jun 27, 2022 9:58 am
by Patrick
I'll have a look at how this could be happening.

-Patrick