So I am connecting to a IoT machine.
I have a bytestring
my_string = '\x01\x00\t\xd2\x01\x00\x01\x04keso\xcc' Sending the string like this works perfect:
self._sock.send(b'\x01\x00\t\xd2\x01\x00\x01\x04keso\xcc') but this fails
self._sock.send(my_string) #=> Error #TypeError: a bytes-like object is required, not 'str' so, my mission now is to get the string to be sent, and when i try to add my_string.encode(), then string will become b'\x01\x00\t\xc3\x92\x01\x00\x01\x04keso\xc3\x8c' which is not a correct representation, should be b'\x01\x00\t\xd2\x01\x00\x01\x04keso\xcc'
How the heck do I convert this?
my_stringis not a byte string.