Skip to content
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

NoneType error when calling client.pair() on Android #1531

Open
skywodd opened this issue Mar 29, 2024 · 1 comment
Open

NoneType error when calling client.pair() on Android #1531

skywodd opened this issue Mar 29, 2024 · 1 comment
Labels
Backend: Android bug Something isn't working

Comments

@skywodd
Copy link

skywodd commented Mar 29, 2024

  • bleak version: 0.21.1
  • Python version: 3.11
  • Operating System: Android 13
  • BlueZ version (bluetoothctl -v) in case of Linux:

Description

The p4android backend seem to have a bug in the BleakClientP4Android.pair() method.
When called, the function is working but always crash with the exception TypeError: object NoneType can't be used in 'await' expression.

This is caused by the line await receiver.stop().
It look like the BroadcastReceiver.stop() method is just a plain def, not a async def :
https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/recipes/android/src/android/broadcast.py#L67

What I Did

Run the kivy example with an added await client.pair() after the client connection.

Logs

03-28 19:38:56.988 22522 18640 I python  :  Traceback (most recent call last):
03-28 19:38:56.989 22522 18640 I python  :    File "/REDACTED/.buildozer/android/app/main.py", line 327, in _handle_sensor
03-28 19:38:56.989 22522 18640 I python  :    File "/REDACTED/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/androidkivytest/arm64-v8a/bleak/__init__.py", line 640, in pair
03-28 19:38:56.989 22522 18640 I python  :    File "/REDACTED/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/androidkivytest/arm64-v8a/bleak/backends/p4android/client.py", line 213, in pair
03-28 19:38:56.990 22522 18640 I python  :  TypeError: object NoneType can't be used in 'await' expression
@moisesms0
Copy link

Did you fix it? i have the same error in almost the same situation

@dlech dlech added bug Something isn't working Backend: Android labels Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend: Android bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants