-
Notifications
You must be signed in to change notification settings - Fork 305
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
Could not determine BlueZ version, bluetoothctl not available, assuming 5.51+ #1183
Comments
I thought it might be that the client is running in a subprocess, but a quick check didn't provide any further insight import asyncio
import multiprocessing
import os
import bleak.backends.bluezdbus.version as bv
async def subprocess_task():
version_output = await bv._get_bluetoothctl_version()
if version_output:
major, minor = tuple(map(int, version_output.groups()))
print(major, minor)
else:
print("No version_output")
await asyncio.sleep(1.0)
def subprocess_work():
sploop = asyncio.new_event_loop()
print(f"Inner loop: {sploop} {os.getpid()} {sploop._selector}")
sploop.run_until_complete(subprocess_task())
if __name__ == '__main__':
multiprocessing.set_start_method('spawn', force=True)
loop = asyncio.new_event_loop()
print(f"Outer loop: {loop} {os.getpid()} {loop._selector}")
loop.run_until_complete(subprocess_task())
p = multiprocessing.Process(target=subprocess_work)
p.start()
|
Maybe |
Just checked that, from within the process that is managing the bluetooth:
There's also Once I have some more coffee, I'll try a wrapper at |
Puzzling, as adding a wrapper "fixes" things. After determining that the wrapper fixed the issue at There is a subtle difference in the log messages with Moved the executable to Without the wrapper (failure):
With the wrapper (successful)
The wrapper:
The ownership and contents of the output files are Two differences with the original wrapper were that
It looks to be something different between the call to a script and the call to the executable directly as just wrapping the executable in a script succeeds
The earlier noted "idle" may be a red herring, as it is seen here as well (as well as the "closed by peer" variant).
|
Seems to occur with Python 3.11.1, but not in 3.10.9 or 3.9.2 Edit: It does not seem to occur with 3.11.0 Maybe: python/cpython#100133 |
Resolved in 3.11-dev as installed by pyenv this evening. Closing at this appears to be a Python issue |
As it turned out, there was a regression in Python 3.11.1 related to loss of output from subprocesses. Refs: hbldh/bleak#1183 python/cpython#100133
Running on Raspberry Pi 3B+
bluetoothctl -v
) in case of Linux: 5.55Description
When bleak initializes, it appears to make a call to get the BlueZ version. Although the user under which the process is running is a member of the
bluetooth
group and can runbluetoothctl
from the command line as well as from within Python, the call apparently fails.In examining the code at
bleak/backends/bluezdbus/version.py
, the seemingly relevant function was tested on the target system with the target user and venv.Running within a complex program under the same user and venv, it fails with the following logs
Any suggestions as how to diagnose this further?
The text was updated successfully, but these errors were encountered: