hologram-io/hologram-python

Unable to receive data message from dashboard

donbonjenbi opened this issue · 3 comments

Describe the problem

Upon receiving a data message from the dashboard, I'm getting the following error:

Actual behavior

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

Steps to reproduce the behavior

result = hologram.network.connect()
hologram.initializeReceiveSocket()
for i in range(20):
   message = self.hologram.popReceivedMessage()
   print(f"Data_msg received:  {message}" if message else "no data_msg")

System information

  • Linux
  • hologram-python version: 0.9.0
  • Python 3.7
  • NOVA + SARA-R10M

I got it to work if I modify the following in CustomCloud.py:

    def __incoming_connection_thread(self, clientsocket):

        clientsocket.settimeout(RECEIVE_TIMEOUT)

        # Keep parsing the received data until timeout or receive no more data.
        recv = ''

changed to:

    def __incoming_connection_thread(self, clientsocket):

        clientsocket.settimeout(RECEIVE_TIMEOUT)

        # Keep parsing the received data until timeout or receive no more data.
        recv = b''

Thanks for pointing this out, ill make a fix for it

Should be fixed by #74