dan-dekalb
Newbie
I am redoing my scanner deployment. I have installed Ubuntu on a Raspberry Pi 4, I have the Trunk Recorder Docker and Liquid Soap Docker up and running, I'm uploading to Broadcastify Calls no problem decoding P25 Phase 2. My problem is that the Trunk Recorder Docker only includes Python 3. When I try to implement the "streamthis.py" scripts at Streaming with Trunk Recorder and Liquidsoap - The RadioReference Wiki, when I try to send to the liquidsoap socket, I get the following message:
File "/home/xxx/trunk-docker/./scripts/streamthis2.py", line 88, in <module>
sock.sendall(message)
TypeError: a bytes-like object is required, not 'str'
I know just enough python to read and copy code. I've understand that I have to convert the string into a byte array using the encode function which results in the following output:
Sending encoded "b'queue.push ./audio_files/Starcom/2022/5/4/1901-1651686776_854387500-call_16344.wav\n\r'
received "b'ERROR: unknown c'
Basically it's sending the string "b'queue.push ./audio_files/Starcom/2022/5/4/1901-1651686776_854387500-call_16344.wav\n\r'" to the LiquidSoap socket, which isn't what it's looking for, so it responds with an error. LiquidSoap just wants what's between the single quotes. I've been going round and round since Sunday on this issue, and I'm about to the point of rewriting streamthis in Perl. All the web searching I've found says that Python 3 requires sockets to support unicode encoding, and I should change the program on the other side. Anyone else have a working streamthis under python 3 or any other advice before I start rewriting?
Thanks
Dan
File "/home/xxx/trunk-docker/./scripts/streamthis2.py", line 88, in <module>
sock.sendall(message)
TypeError: a bytes-like object is required, not 'str'
I know just enough python to read and copy code. I've understand that I have to convert the string into a byte array using the encode function which results in the following output:
Sending encoded "b'queue.push ./audio_files/Starcom/2022/5/4/1901-1651686776_854387500-call_16344.wav\n\r'
received "b'ERROR: unknown c'
Basically it's sending the string "b'queue.push ./audio_files/Starcom/2022/5/4/1901-1651686776_854387500-call_16344.wav\n\r'" to the LiquidSoap socket, which isn't what it's looking for, so it responds with an error. LiquidSoap just wants what's between the single quotes. I've been going round and round since Sunday on this issue, and I'm about to the point of rewriting streamthis in Perl. All the web searching I've found says that Python 3 requires sockets to support unicode encoding, and I should change the program on the other side. Anyone else have a working streamthis under python 3 or any other advice before I start rewriting?
Thanks
Dan