kivy / oscpy

An efficient OSC implementation compatible with python2.7 and 3.5+
MIT License
109 stars 27 forks source link

blob packing exception #68

Open ibobalo opened 2 years ago

ibobalo commented 2 years ago

Describe the bug client send_message raise exception when sending blobs

To Reproduce OSCClient(b'localhost', 10000).send_message(b'/my_uuid', [bytearray(range(16)),])

Expected behavior 16 bytes blob sent to server

Logs/output Traceback (most recent call last): File "", line 1, in File "C:\Utils\Python3\lib\site-packages\oscpy\client.py", line 136, in send_message stats = send_message( File "C:\Utils\Python3\lib\site-packages\oscpy\client.py", line 63, in send_message message, stats = format_message( File "C:\Utils\Python3\lib\site-packages\oscpy\parser.py", line 271, in format_message message = pack( struct.error: pack expected 26 items for packing (got 3)

Platform (please complete the following information):

Additional context THE REASON WRITERS = ( ... (bytearray, (b'b', b'%ib')), mean struct.pack(b'16b', bytearray(range(16))) # it is not valid struct.error: pack expected 16 items for packing (got 1)

FIX it shoulfd be: struct.pack(b'16s', bytearray(range(16))) so, WRITERS = ( ... (bytearray, (b's', b'%ib')),