decode_edn_msg - ValueError: substring not found
Often see a report like this at the start of running script, it looks like two commands have been merged together...
$ python3 toggle_bpm.py -p -d
Starting scheduler
/home/simon/Carabiner/Carabiner_Linux_x64
Waiting for Carabiner
LinkInterface Started
Unrecognized command: enable-start-stop-syncstart-playing
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.6/dist-packages/LinkToPy-0.2.4-py3.6.egg/LinkToPy/LinkToPy.py", line 182, in _listener
msg_type, msg_data = self.decode_edn_msg(msg)
File "/usr/local/lib/python3.6/dist-packages/LinkToPy-0.2.4-py3.6.egg/LinkToPy/LinkToPy.py", line 39, in decode_edn_msg
msg_type = msg[:msg.index(' {')]
ValueError: substring not found```
https://github.com/Deep-Symmetry/carabiner#protocol
says...
To protect against multiple messages being read as one, because they were sent right after one another and delivered as a single network packet, you should always put a newline character at the end of the message. As of version 1.1.0, Carabiner can process multiple commands in a single network packet, as long as they are separated by newlines. Trailing newlines will not cause any problems for older versions of Carabiner, but those versions will not see any commands following the first in a given packet.
Looks like the msg returned from Carabiner does not contain a { which causes error
<class 'str'>
unsupported enable-start-stop-syncstart-playing