MikeCoder96 / HappyLighting-py

HappyLight BLE communication using Bleak (QHM Led Controller)
GNU Affero General Public License v3.0
20 stars 5 forks source link

Bleak error #24

Open ImShEthan opened 3 months ago

ImShEthan commented 3 months ago

Hello, i'm having trouble when scanning, got this error :

libpng warning: iCCP: known incorrect sRGB profile
Traceback (most recent call last):
  File "C:\Users\Tatane\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\qasync\__init__.py", line 780, in _error_handler
    task.result()
  File "C:\Users\Tatane\Downloads\HappyLighting-py-master\LEDStripController\pyhl.py", line 284, in handle_scan
    devices = await BLEClass.BleakScanner.discover(timeout=8.0)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Tatane\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\bleak\__init__.py", line 320, in discover
    async with cls(**kwargs) as scanner:
  File "C:\Users\Tatane\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\bleak\__init__.py", line 158, in __aenter__
    await self._backend.start()
  File "C:\Users\Tatane\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\bleak\backends\winrt\scanner.py", line 222, in start
    assert_mta()
  File "C:\Users\Tatane\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\bleak\backends\winrt\util.py", line 78, in assert_mta
    raise BleakError(
bleak.exc.BleakError: The current thread apartment type is not MTA: STA. Beware of packages like pywin32 that may change the apartment type implicitly.
MikeCoder96 commented 3 months ago

have you installed requirements via requirements.txt?

ImShEthan commented 3 months ago

have you installed requirements via requirements.txt?

Yeah I did

MikeCoder96 commented 3 months ago

Tried to replicate it and it happens to me only if I try to press search multiple time. I think that this is not your case right?

ImShEthan commented 3 months ago

Hello, sorry for the long responce, No I don't press the search button multiple times, maybe I don't understand how to use it. I link a gif of the error.

explorer_ZFPoHwfQyQ