QLab OSC command from Python script bug?

230 views
Skip to first unread message

Boz Konta

unread,
May 4, 2021, 3:40:06 PM5/4/21
to QLab

Hi All,

I have written a simple Python script that sends OSC commands to QLab.
Everything works fine until I want to move a cue into a previously created group.

The OSC command is:

/workspace/{id}/move/{cue_id} {new_index} {new_parent_cue_id}

If I fill the command with the appropriate IDs and send it to QLab then the following error message shows up in the console:

Could not find a cue matching ID '5756BDE7-6CF4-4FEF-8649-D6D10F5D13BE 1 FA842791-9314-4E06-B5E4-E0076ACD0D66'; not moving cue.

But if I copy and paste the logged command from the log window into a new network cue, then it works.

Any thoughts on the problem, please?

Many thanks,
Boaz

James Cooper

unread,
May 4, 2021, 4:13:20 PM5/4/21
to QLab
Hi Boaz,

Python can be a bit particular with variable types in commands, especially with the python-osc library - I've had issues before parsing floats interchangeably with integers, for example, when parsing it through python-osc.

My guess would be that the cue ID is getting translated as some sort of JSON type/object / bytes type in the OSC command, but when you copy and paste it from the log, it'll be a string - which would explain why that will work.

That said, I've never controlled QLab specifically with python or OSC before - so I've got no idea if QLab is doing something else.

It might be worth using Wireshark to inspect the OSC packet, to see if the packet is what you're expecting.

Best,
James

Brent Lord

unread,
May 4, 2021, 4:24:46 PM5/4/21
to QLab
Hi Boaz -

I'm not familiar with the python-osc library, but the error message you received suggests to me that somehow your arguments were joined together with your cue_id all as one string. 

Your outgoing OSC message should have an address string like /workspace/{id}/move/5756BDE7-6CF4-4FEF-8649-D6D10F5D13BE  (but with the correct workspace ID filled in) and then two arguments, an integer and a string FA842791-9314-4E06-B5E4-E0076ACD0D66.

Brent Lord
Figure 53

Boz Konta

unread,
May 5, 2021, 4:47:38 PM5/5/21
to QLab
Thank you for the quick responses!

I have checked with Wireshark and it seemed to me like a normal packet.

I tried a lot of things with the move message formatting, but nothing worked.

In my first message I forgot to attach the source files, but I did right now.

The python-osc package needs to be installed with

pip3 install python-osc

and the main program is

Qlabtitles.py

It does not use example-input.txt yet, but my goal is for it to read a text file line by line,
put the lines in text cue and put every text cue inside a group cue, and later also put a fade cue,
to make the text displayable line by line.

Any further insights, please?

Many thanks,
Boaz
Qlabtitles.py
qlabdef.py
example-input.txt

Brent Lord

unread,
May 5, 2021, 5:28:47 PM5/5/21
to QLab
In line 86 of your qlabdef.py file, it appears that the movecue() function is concatenating all 4 values into a single address string passed to your send_message() function:

self.client.send_message("/workspace/{}/move/{} {} {}".format(wpid, cueid, index, gid))

What I think you want is something subtly different, like:

self.client.send_message("/workspace/{}/move/{}".format(wpid, cueid), index, gid)

(You'll need a slightly different approach in your send_message() function to accept two argument values, but you see the idea.)
Note that now the address string only includes the wpid and cueid values. Your remaining two values index and gid should be added to the message as arguments using add_arg().

The same idea applies to your renumber_cues() function too... the wpid value alone should be part of the address string, and the start and inc values should be added to your message using add_arg().

Brent Lord
Figure 53
Reply all
Reply to author
Forward
0 new messages