I am trying to interface between a radio and computer via USB. Here is the code that I am using:
def __getSync(self, raise_error=True):
c = self.__recv(raise_error)
if c is None:
return False
if (c != self.INSYNC):
self.debug("unexpected 0x%x instead of INSYNC (0x%x)" % (c, self.INSYNC))
if raise_error:
raise RuntimeError("unexpected 0x%x instead of INSYNC (0x%x)" % (c, self.INSYNC))
return False
c = self.__recv()
if (c != self.OK):
self.debug("unexpected 0x%x instead of OK (0x%x)" % (c, self.OK))
if raise_error:
raise RuntimeError("unexpected 0x%x instead of OK (0x%x)" % (c, self.OK))
return False
self.debug("__getSync OK", 2)
return True
And when I do I receive the the following message:
Traceback(most recent call last):
File "uploader.py", line 152, in __getSync
self.debug("unexpected 0x%x instead of INSYNC (0x%x)" % (c, self.INSYNC))
TypeError: %x format: an integer is required, not bytes
I have tried int.from_bytes(c, "big") only to have 'bytes' in the error message be replaced with 'str'. Anybody able to give any help?
Thanks in advance.