I am receiving a binary stream (over a socket) and converting it to bytearray
. After running for about 6hrs (and sometimes even after few minutes) I am getting the following error:
TypeError: string argument without an encoding
on the line:
str = binascii.hexlify(bytearray(result))
The code which is receiving the data and converting it to bytearray
is as follows :
try:
result = so.recv()
str = binascii.hexlify(bytearray(result))
except:
I referred to the question Python String argument without an encoding and Python 3 documentation but no luck in solving this issue.
Could this be corrupted data in the stream (maybe a network issue)?