REL1100 Error Handler Callback Description Datatype

Supporting 2.7 and 3.2+
Post Reply
jnbastoky
Phidgetsian
Posts: 13
Joined: Sun Apr 15, 2018 9:03 am
Contact:

REL1100 Error Handler Callback Description Datatype

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

User avatar
Patrick
Lead Developer
Posts: 3399
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: REL1100 Error Handler Callback Description Datatype

Post by Patrick »

I'll have a look at how this could be happening.

-Patrick
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest