Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blob packing exception #68

Open
ibobalo opened this issue May 23, 2022 · 0 comments
Open

blob packing exception #68

ibobalo opened this issue May 23, 2022 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ibobalo
Copy link

ibobalo commented May 23, 2022

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):

  • OS: windows 10
  • Python 3.7
  • release

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')),

@tshirtman tshirtman added bug Something isn't working good first issue Good for newcomers labels May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants