You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Examples (and some code too) use the asyncio.get_event_loop().run_until_complete() function call chain to run asynchronous functions.
With Python 3.12 a DeprecationWarning is emitted: ruuvitag-sensor/examples/get_async_bleak.py:18: DeprecationWarning: There is no current event loop. Python get_event_loop() documentation recommends to either use get_running_loop() or asyncio.run(). Using get_running_loop() results in the below error so it is not a straightforward replacement.
$ python3 examples/get_async_bleak.py
Traceback (most recent call last):
File "<redacted>/ruuvitag-sensor/examples/get_async_bleak.py", line 18, in <module>
asyncio.get_running_loop().run_until_complete(main())
^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop
I am wondering what would be the best way to fix the DeprecationWarning.
There is no rush to fix this but fixing this before the call results in an error would be advisable.
Environment:
OS: Gentoo
ruuvitag_sensor package version: master (2.3.1)
RuuviTag firmware version: not relevant
Data format: not relevant
The text was updated successfully, but these errors were encountered:
Examples (and some code too) use the
asyncio.get_event_loop().run_until_complete()
function call chain to run asynchronous functions.With Python 3.12 a DeprecationWarning is emitted:
ruuvitag-sensor/examples/get_async_bleak.py:18: DeprecationWarning: There is no current event loop
. Pythonget_event_loop()
documentation recommends to either useget_running_loop()
orasyncio.run()
. Usingget_running_loop()
results in the below error so it is not a straightforward replacement.I am wondering what would be the best way to fix the DeprecationWarning.
There is no rush to fix this but fixing this before the call results in an error would be advisable.
Environment:
The text was updated successfully, but these errors were encountered: