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

examples/service_explorer.py Unhandled timeout error in service_explorer.py / CentralManagerDelegate.py on macOS #1335

Open
jsmif opened this issue Jun 14, 2023 · 1 comment
Labels
Backend: Core Bluetooth Issues and PRs relating to the Core Bluetooth backend more info required Issues does not have a reproducible test case, has insufficent logs or otherwise needs more feedback

Comments

@jsmif
Copy link

jsmif commented Jun 14, 2023

  • bleak version: bleak-0.21.0a
  • Python version: Python 3.11.3
  • Operating System: macOS 13.3.1 (a)

Description

Testing examples/service_explorer.py on macOS since it doesn't work for me on Linux (#1333 )

What I Did

python3 service_explorer.py --address F8607851-010B-B680-D5E6-55C07864A794
2023-06-14 09:06:40,788 __main__ INFO: starting scan...
2023-06-14 09:06:43,927 __main__ INFO: connecting to device...
Traceback (most recent call last):
  File "/Users/user/Desktop/tmp/bleak/bleak/backends/corebluetooth/CentralManagerDelegate.py", line 171, in connect
    await future
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/user/Desktop/tmp/bleak/examples/service_explorer.py", line 129, in <module>
    asyncio.run(main(args))
  File "/usr/local/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/user/Desktop/tmp/bleak/examples/service_explorer.py", line 41, in main
    async with BleakClient(
  File "/Users/user/Desktop/tmp/bleak/bleak/__init__.py", line 491, in __aenter__
    await self.connect()
  File "/Users/user/Desktop/tmp/bleak/bleak/__init__.py", line 531, in connect
    return await self._backend.connect(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/Desktop/tmp/bleak/bleak/backends/corebluetooth/client.py", line 125, in connect
    await manager.connect(self._peripheral, disconnect_callback, timeout=timeout)
  File "/Users/user/Desktop/tmp/bleak/bleak/backends/corebluetooth/CentralManagerDelegate.py", line 170, in connect
    async with async_timeout(timeout):
  File "/usr/local/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/timeouts.py", line 111, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

This occurred when attempting to connect to an Apple AirTag that was listed by BleakScanner.discover(). Note, service_explorer.py has worked for me for at least one device though.

Logs

Unfortunately I cannot provide logs as that would provide my exact physical location (see: wigle.net)

@jsmif jsmif changed the title Unhandled timeout error in service_explorer.py / CentralManagerDelegate.py on macOS examples/service_explorer.py Unhandled timeout error in service_explorer.py / CentralManagerDelegate.py on macOS Jun 14, 2023
@dlech
Copy link
Collaborator

dlech commented Jun 14, 2023

Did the OS prompt for any kind of authentication?

It is not possible to diagnose further without additional logs.

@dlech dlech added Backend: Core Bluetooth Issues and PRs relating to the Core Bluetooth backend more info required Issues does not have a reproducible test case, has insufficent logs or otherwise needs more feedback labels Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend: Core Bluetooth Issues and PRs relating to the Core Bluetooth backend more info required Issues does not have a reproducible test case, has insufficent logs or otherwise needs more feedback
Projects
None yet
Development

No branches or pull requests

2 participants