attwad/python-osc

use add_arg within a for loop

nbrochec opened this issue · 1 comments

First of all, I am not a professional developer in Python, so maybe the solution seems obvious for you. Sorry for that.

Before to submit an issue report on this repository, I have posted this on stackoverflow. I did not get any answer.

To be brief, I want to add arguments to my OSC message without knowning the exact length of a list (the list of values I want to send via OSC).
The thing is, I want to avoid typing my OSC message argument such as below, because the length of the list may change from one use to another.

probabilityMSG.add_arg(classProbability[0], arg_type='f')
probabilityMSG.add_arg(classProbability[1], arg_type='f')
probabilityMSG.add_arg(classProbability[2], arg_type='f')
probabilityMSG.add_arg(classProbability[3], arg_type='f')

So I tried to use a for loop for that.

for i in range(len(classProbability)):
probabilityMSG.add_arg(classProbability[i], arg_type='f')

There is no error displayed on the Terminal when I run the code, but I did not receive any OSC message on my client.
Maybe there is a straightforward way to do it but I did not find anything in the documentation.

Thank you for your help.

I have no idea why it didn't work last time. But, yeah, seems to work with add_arg within a for loop.