aioblescan: 'NoneType' object is not subscriptable
Hello,
I’m getting 'NoneType' object is not subscriptable error when run python3 -m aioblescan on Debian Bullseye (armv6, Rapberry Pi 1 B+)
Python version: 3.9.2
aioblescan: 0.2.10
Here is the stacktrace:
Fatal error: protocol.data_received() call failed.
protocol: <aioblescan.aioblescan.BLEScanRequester object at 0xb61293e8>
transport: <_SelectorSocketTransport fd=6 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
File "/usr/lib/python3.9/asyncio/selector_events.py", line 870, in _read_ready__data_received
self._protocol.data_received(data)
File "/usr/local/lib/python3.9/dist-packages/aioblescan/aioblescan.py", line 1852, in data_received
self.process(packet)
File "/usr/local/lib/python3.9/dist-packages/aioblescan/__main__.py", line 51, in my_process
xx = ev.decode(data)
File "/usr/local/lib/python3.9/dist-packages/aioblescan/aioblescan.py", line 1303, in decode
data = ev.decode(data)
File "/usr/local/lib/python3.9/dist-packages/aioblescan/aioblescan.py", line 1350, in decode
data = ev.decode(data)
File "/usr/local/lib/python3.9/dist-packages/aioblescan/aioblescan.py", line 833, in decode
data = field.decode(data)
File "/usr/local/lib/python3.9/dist-packages/aioblescan/aioblescan.py", line 1473, in decode
data = x.decode(data)
File "/usr/local/lib/python3.9/dist-packages/aioblescan/aioblescan.py", line 236, in decode
self._val = unpack(">B", data[:1])[0]
TypeError: 'NoneType' object is not subscriptable
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (15 by maintainers)
Commits related to this issue
- Fix to #44. Thank you @shadowsgit — committed to frawau/aioblescan by frawau 2 years ago
@shadowsgit Thanks for the PR @Ernst79 new release pushed to PyPi
@Ernst79 me also used its as HA integration, but in my case it somehow works fine without above fix with HA, but it was failed in few seconds when I launch aioblescan as is. (or HA at least restart plugin). To be honest I don’t know how to get similar log from HA as mentioned in https://github.com/custom-components/ble_monitor/issues/433 )) Formally you reported other issue… But looking into official bluez sample make me believe that payload inside #36 is totally correct and it parsing should looks like:
So repro code
And the fix #46:
and correct output:
As a suggestion for debugging… Have
sudo btmonrunning in a different terminal. That should give you the raw data coming in.