The following code works fine in python 2.7:
def GetMaxNoise(data, max_noise):
for byte in data:
noise = ComputeNoise(struct.unpack('=B',byte)[0])
if max_noise < noise:
max_noise = noise
return max_noise
where data is a string holding binary data (taken from a network packet).
I'm trying to port it to Python 3 and I get this:
File "Desktop/Test.py", line 2374, in GetMaxNoise
noise = ComputeNoise(struct.unpack('=B',byte)[0])
TypeError: 'int' does not support the buffer interface
How can I convert "data" to the appropriate type needed by unpack()?