Skip to content

blob packing exception #68

Open
Open
@ibobalo

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions