hbldh / bleak

A cross platform Bluetooth Low Energy Client for Python using asyncio
MIT License
1.56k stars 275 forks source link

backends/winrt: raise exception when trying to scan with STA #1556

Closed dlech closed 2 weeks ago

dlech commented 2 weeks ago

The pywin32-related packages will implicitly set the threading model to STA when imported. Since Bleak is using WinRT for async methods and we don't have a Windows event loop running, we need to let users know that Bleak is not going to work in this case.

Also add a utility function and troubleshooting docs to provide a workaround for this issue.

Fixes: https://github.com/hbldh/bleak/issues/1132