-
Notifications
You must be signed in to change notification settings - Fork 79
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
Comments
@ttu could you kindly provide some input on this? |
Like you mentioned we should replace asyncio's In RuuviTag's codebase, asyncio is not used in many places (main, Bleak, RX, examples, and documentation), but we should still ensure that everything works correctly after the change. At least these come to my mind now. Can you think something I might have missed?
|
Sorry for the late reply. Please find some answers to your questions below. I will open a PR to update the examples shortly.
This seems to be the case per my testing.
I didn't see any error when trying to run an example using
Per Python documentation using
This is a tricky question. The fix proposed by you in the issue indeed works but should it and how should it be applied to the code? Some kind of Python "#ifdef" would be possible but it seems quite dirty to me. About dropping Python 3.9 support: are there any statistics which would show many users still using Python 3.9 downloading this package? |
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: