aws/aws-iot-device-sdk-python

greengrass discovery throwing bytestream issue

manasir66 opened this issue · 3 comments

Hi,

I am running into a TypeError when calling the discover() function from DiscoverInfoProvider module.

Below is the my code snippet (following the example in the documentation) and the error encountered.

from AWSIoTPythonSDK.core.greengrass.discovery.providers import DiscoveryInfoProvider
rootCAPath = "<path_to_file>"
certificatePath = "<path_to_file>"
privateKeyPath = "<path_to_file>"
host = "<IoTHost>"
thingName = "name"

discoveryInfoProvider = DiscoveryInfoProvider()
discoveryInfoProvider.configureEndpoint(host)
discoveryInfoProvider.configureCredentials(rootCAPath, certificatePath, privateKeyPath)

#Error causing line
discoveryInfo = discoveryInfoProvider.discover(thingName)

This is the error :

'Traceback (most recent call last):
  File "/inference/discover.py", line 37, in <module>
    discoveryInfo = discoveryInfoProvider.discover(thingName)
  File "/inference/AWSIoTPythonSDK/core/greengrass/discovery/providers.py", line 230, in discover
    status_code, response_body = self._receive_discovery_response(ssl_sock)
  File "/inference/AWSIoTPythonSDK/core/greengrass/discovery/providers.py", line 356, in _receive_discovery_response
    rc1, response_header = self._receive_until(ssl_sock, self._got_two_crlfs)
  File "/inference/AWSIoTPythonSDK/core/greengrass/discovery/providers.py", line 371, in _receive_until
    response.append(self._convert_to_int_py3(ssl_sock.read(1)))
**TypeError: 'bytes' object cannot be interpreted as an integer'**

How often are you getting this error?

Thanks for pointing this out. This sdk was incorrectly using append when using a bytearray when it should be using extend. I have created a PR for this. Sorry this has taken a long time.

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.