Hello,
I have a Nova connected to my Raspberry Pi that is able to connect to the network and receive messages via CLI with no problem, but my Python script is throwing some weird exceptions that I am having a lot of trouble debugging.
I have the following code:
import serial, time
from Hologram.HologramCloud import HologramCloud
hologram = HologramCloud(dict(), network='cellular')
result = hologram.network.connect()
if result == False:
print('Error: failed to connect to cellular network')
else:
print('Connected to '+hologram.network_type+' v'+hologram.version)
def serial_write():
data = hologram.popReceivedMessage()
print(data)
hologram.openReceiveSocket()
while True:
hologram.event.subscribe('message.received', serial_write)
hologram.closeReceiveSocket()
The script runs and connects fine, but when I send a cloud message, I get the following error:
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/dist-packages/Hologram/CustomCloud.py", line 336, in __incoming_connection_thread
recv += result
TypeError: can only concatenate str (not "bytes") to str
Could be my usage of the SDK, but basically my goal is to run this script as a daemon and forward inbound cloud messages to a Serial port. Any help is greatly appreciated, thanks.