Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation warning in examples #246

Open
terop opened this issue Mar 11, 2024 · 0 comments
Open

Deprecation warning in examples #246

terop opened this issue Mar 11, 2024 · 0 comments
Labels

Comments

@terop
Copy link
Contributor

terop commented Mar 11, 2024

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
@terop terop added the bug label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant