kevincar / bless

Cross-platform Bluetooth Low Energy Server Python Library
MIT License
78 stars 26 forks source link

TypeError: tp_basicsize for type '_bleak_winrt_Windows_Foundation.EventRegistrationToken' (24) is too small for base '_winrt.Object' (32) #116

Open fernandoaestrella opened 8 months ago

fernandoaestrella commented 8 months ago

The problem Provide a clear and concise description of what the problem is.

Copied the example from here https://github.com/kevincar/bless/blob/master/examples/server.py and ran it

Reproduction Provide instructions or code samples that demonstrate the issue if possible>

Copied the example from here https://github.com/kevincar/bless/blob/master/examples/server.py to VS Code in a new python file, inside a virtual environment (virtual environment folder is called ".venv")

imported bless via python -m pip install bless and ran it an error indicated I didn't have bleak_winrt so i got it via python -m pip install bleak-winrt then I ran it again and got the error below

Expected behavior Provide a clear and concise description of what you expected to happen.

Expected the server to run and advertise a BLE message

Screenshots If applicable, add screenshots to help explain your problem.

Traceback (most recent call last): File "d:\dev\magic\py\sb\boxes\ble_s\main.py", line 12, in from bless import ( # type: ignore File "d:\dev\magic\py\venv\Lib\site-packages\bless__init.py", line 41, in from bless.backends.winrt.server import ( # noqa: F401 File "d:\dev\magic\py\venv\Lib\site-packages\bless\backends\winrt\server.py", line 14, in from bless.backends.winrt.service import BlessGATTServiceWinRT File "d:\dev\magic\py\venv\Lib\site-packages\bless\backends\winrt\service.py", line 4, in from bleak_winrt.windows.devices.bluetooth.genericattributeprofile import ( # type: ignore # noqa: E501 File "d:\dev\magic\py\venv\Lib\site-packages\bleak_winrt\windows\devices\bluetooth__init.py", line 10, in import bleak_winrt.windows.devices.bluetooth.genericattributeprofile File "d:\dev\magic\py\venv\Lib\site-packages\bleak_winrt\windows\devices\bluetooth\genericattributeprofile\init.py", line 15, in import bleak_winrt.windows.devices.enumeration File "d:\dev\magic\py\venv\Lib\site-packages\bleak_winrt\windows\devices\enumeration\init.py", line 15, in import bleak_winrt.windows.foundation File "d:\dev\magic\py\venv\Lib\site-packages\bleak_winrt\windows\foundation\init__.py", line 7, in _ns_module = bleak_winrt._import_ns_module("Windows.Foundation") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "d:\dev\magic\py\venv\Lib\site-packages\bleak_winrt\init__.py", line 15, in _import_ns_module module = module_from_spec(spec) ^^^^^^^^^^^^^^^^^^^^^^ TypeError: tp_basicsize for type '_bleak_winrt_Windows_Foundation.EventRegistrationToken' (24) is too small for base '_winrt.Object' (32)

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

magnusjjj commented 6 months ago

Got the exakt same error, windows 11 :).

goodztc commented 2 months ago

I encountered the same problem and found that using a lower version of Python can solve it, Verified on Python version 3.9.19

goodztc commented 2 months ago

Got the exakt same error, windows 11 :).

you can try Python version 3.9.19