Open Asahi-139 opened 2 weeks ago
It sounds like Bleak didn't get installed correctly on Windows 11. The required packages for Python 3.12 on Windows can be found in the pyproject.toml
file.
https://github.com/hbldh/bleak/blob/ce48c7fe470d7ead949d5249b74d571411defbb2/pyproject.toml#L32-L39
If you are running Bleak from the source directory, you can install everything using poetry install
and then run things with poetry run python ...
or use poetry shell
so you don't have to write poetry run
every time.
so what should i do with this one?
and where should i place this one? i am new to this ...so can you help?
On Tue, Jun 11, 2024 at 7:52 PM David Lechner @.***> wrote:
It sounds like Bleak didn't get installed correctly on Windows 11. The required packages for Python 3.12 on Windows can be found in the pyproject.toml file.
https://github.com/hbldh/bleak/blob/ce48c7fe470d7ead949d5249b74d571411defbb2/pyproject.toml#L32-L39
— Reply to this email directly, view it on GitHub https://github.com/hbldh/bleak/issues/1596#issuecomment-2160896686, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2CJ373FXNMSIL3Y4FVVEMDZG4B2JAVCNFSM6AAAAABJEGSGLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRQHA4TMNRYGY . You are receiving this because you authored the thread.Message ID: @.***>
It's not really clear what you did or what you are trying to do, so hard to help without more information. Are you using a virtual environment, etc.?
Hi, this issue seems to be not related only on Win11 but also in Win10. So maybe related to python 3.12 on Windows. I did the test today with a bleak desktop application packaged with pyinstaller with my package for python3.10 and python3.12 and with python3.12 i have the same error.
Can you give the exact steps needed to reproduce the error?
I use poetry as package manager, so firstly I bumped my python version from 3.10 to 3.12 with the set of line python = ">3.11,<3.13"
in pyproject.toml (bleak version in 0.22.2)
Then in my release GitHub action workflow:
poetry update --no-interaction
msg=Received %s.
File "bleak\backends\winrt\scanner.py", line 147, in _received_handler
Exception in callback BleakScannerWinRT._received_handler(<winrt._winrt...00265D2983270>, <winrt._winrt...00265D2983290>)
Traceback (most recent call last):
ModuleNotFoundError: No module named 'winrt.windows.foundation.collections'
Did you try https://pyinstaller.org/en/stable/when-things-go-wrong.html#listing-hidden-imports to see if you can help pyinstaller find the missing packages?
Hi ! I bumped my python version to 3.12 and tried a workaround for pyinstaller in adding this code to my builder script:
"--hidden-import 'winrt.windows.foundation.collections' "
"--collect-all winrt "
And it works, the .exe build is functional. So this thing doesn't explain the bug related to this issue but this allows to build .exe application with a workaround.
Also, to avoid to get looped line Received %s.
when a bug occurs, maybe it will be good to replace line
logger.debug("Received %s.", _format_event_args(event_args))
by
logger.debug("Received %s." % _format_event_args(event_args))
or
logger.debug(f"Received {_format_event_args(event_args)}")
change comma by percent to get string arg and so get the formatted value from function _format_event_args
in file /bleak/backends/winrt class BleakScannerWinRT._received_handler l.117
An even better fix would be to avoid calling _format_event_args
at all if the log level is not debug.
if logger.isEnabledFor(logging.DEBUG):
logger.debug("Received %s.", _format_event_args(event_args))
bluetoothctl -v
) in case of Linux:I am making a GUI which communicates with BLE device and do some work. my bleak module and everything was working fine in the win10. but as soon as i shifted to the win11. i am getting some error whenever i run my exe file. i have tried the same script on win 10 then it is working fine.
i think bleak module doesn't support the win 11 till now. then can anyone help me to work around it as in my company i am not allowed to use win 10.
i have tried installling the winrt and all but nothing seems to work.