May-27-2017, 07:09 PM
When sending data from Max/MSP to Python via UDP all I wind up receiving on the other side is stuff that looks like this:
b'float\x00\x00\x00,f\x00\x00\xc1\x1f\xc2\x8f'
What format is this and how do I convert it back to a float? What I really need to do is send a list of floats such as
3 -8.22241 -7.066427 -5.288864 -2.530465 0.458666 2.289094 2.566208 1.953798 1.114607 0.296125 -0.339662 -0.604555 -0.518344 -0.328184 -0.239883 -0.265401 -0.312797 -0.300493 -0.189546
but that winds up as
b'list\x00\x00\x00\x00,ffffffffffffffffffffffff\x00\x00\x00\xc2\x80\xed%A\xc5\x10\xabA \xddT\xc0\x1c\x89\x1a\xc0\xfb^\xf8\xc1\x03\x8e\xfe\x
c0\xe2 ,\xc0\xa9>_\xc0!\xf3%>\xea\xd6B@\x12\x80\x86@$<\xc1?\xfa\x16\x0f?\x8e\xabt>\x97\x9d\xc1\xbe\xad\xe8=\xbf\x1a\xc4\x1e\xbf\x04\xb2*\xb
e\xa8\x07\xc3\xbeu\xa3\xcb\xbe\x87\xe2\x96\xbe\xa0&\xe8\xbe\x99\xda.\xbeB\x18^'
How does one decode that?
I've discovered that I'm dealing with raw bytes here. However, if I try to use decode() I get an error like this one
File "C:\Users\tothesun\AppData\Local\Programs\Python\Python35\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 38: invalid continuation byte
b'float\x00\x00\x00,f\x00\x00\xc1\x1f\xc2\x8f'
What format is this and how do I convert it back to a float? What I really need to do is send a list of floats such as
3 -8.22241 -7.066427 -5.288864 -2.530465 0.458666 2.289094 2.566208 1.953798 1.114607 0.296125 -0.339662 -0.604555 -0.518344 -0.328184 -0.239883 -0.265401 -0.312797 -0.300493 -0.189546
but that winds up as
b'list\x00\x00\x00\x00,ffffffffffffffffffffffff\x00\x00\x00\xc2\x80\xed%A\xc5\x10\xabA \xddT\xc0\x1c\x89\x1a\xc0\xfb^\xf8\xc1\x03\x8e\xfe\x
c0\xe2 ,\xc0\xa9>_\xc0!\xf3%>\xea\xd6B@\x12\x80\x86@$<\xc1?\xfa\x16\x0f?\x8e\xabt>\x97\x9d\xc1\xbe\xad\xe8=\xbf\x1a\xc4\x1e\xbf\x04\xb2*\xb
e\xa8\x07\xc3\xbeu\xa3\xcb\xbe\x87\xe2\x96\xbe\xa0&\xe8\xbe\x99\xda.\xbeB\x18^'
How does one decode that?
I've discovered that I'm dealing with raw bytes here. However, if I try to use decode() I get an error like this one
File "C:\Users\tothesun\AppData\Local\Programs\Python\Python35\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 38: invalid continuation byte