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

DeprecationWarning: There is no current event loop #1056

Open
kjeldflarup opened this issue Jan 4, 2023 · 1 comment
Open

DeprecationWarning: There is no current event loop #1056

kjeldflarup opened this issue Jan 4, 2023 · 1 comment

Comments

@kjeldflarup
Copy link
Contributor

I get an annoying warning at the end of my pytest session, when running on the latest master

test_setup/test_setup.py::test_setup_ip
  /usr/local/lib/python3.10/dist-packages/labgrid/remote/client.py:1238: DeprecationWarning: There is no current event loop
    loop = asyncio.get_event_loop()

test_setup/test_setup.py::test_setup_ip
  /usr/local/lib/python3.10/dist-packages/autobahn/asyncio/websocket.py:300: DeprecationWarning: There is no current event loop
    self.loop = loop or asyncio.get_event_loop()

test_setup/test_setup.py::test_setup_ip
  /usr/local/lib/python3.10/dist-packages/autobahn/asyncio/wamp.py:238: DeprecationWarning: There is no current event loop
    loop = asyncio.get_event_loop()

I tried to update autobahn to latest version, but the error stil exists. Anybody knows why this warning comes.

@Bastian-Krause
Copy link
Member

Bastian-Krause commented Jan 4, 2023

What exact Python version are you using?

See the deprecation notices in https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop. Python 3.10.0–3.10.8 emitted these warnings by mistake in some cases.

The event loop has to be created and set explicitly now before asyncio.get_event_loop() is called. So to get rid of all these warnings, we need to make sure that this is the case. I guess that's the job of autobahn in most cases. In the client we probably need to do this ourselves, i.e. here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants