Skip to content

from_stream method of Packet class fails #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lcongdon opened this issue Feb 3, 2021 · 3 comments
Closed

from_stream method of Packet class fails #27

lcongdon opened this issue Feb 3, 2021 · 3 comments

Comments

@lcongdon
Copy link
Contributor

lcongdon commented Feb 3, 2021

The from_stream method of class Packet fails in Python 3.7.3 on Raspberry Pi.

Error message is:

Traceback (most recent call last):
  File "ble_prototype_host.py", line 63, in <module>
    packet = Packet.from_stream(stream)
  File "/home/pi/.local/lib/python3.7/site-packages/adafruit_bluefruit_connect/packet.py", line 107, in from_stream
    packet_class = cls._type_to_class.get(header, None)
TypeError: unhashable type: 'bytearray'

Can this be resolved by changing:

header = start + packet_type

on the previous line in the library to:

header = bytes(start + packet_type)

thus making header hashable?

@dhalbert
Copy link
Contributor

dhalbert commented Feb 3, 2021

Thanks! That looks like the right fix. Are you able to submit a PR?

@lcongdon
Copy link
Contributor Author

lcongdon commented Feb 4, 2021 via email

@dhalbert
Copy link
Contributor

Fixed by #28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants