`RuntimeError: no running event loop` after upgrading to 0.5.0
See original GitHub issueUnfortunately, changes in #246 broke the code that relies on creating an instance of janus.Queue outside of the scope of a running event loop, for no obvious reason.
Also, the behavior now contradicts with the behavior of asyncio.Queue.
>>> import asyncio
>>> asyncio.Queue()
<Queue at 0x7f76be085730 maxsize=0>
>>> import janus
>>> janus.Queue()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/projects/project/.venv/lib64/python3.8/site-packages/janus/__init__.py", line 29, in __init__
self._loop = current_loop()
RuntimeError: no running event loop
Is there any good reason to not just use asyncio.get_event_loop? From performance perspective it shouldn’t be significant.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
"RuntimeError: no running event loop" with "asyncio ...
If there is no running event loop a RuntimeError is raised. This function can only be called from a coroutine or a callback....
Read more >no running event loop after update to v 8.0 #5274 - GitHub
I had a python script working on v7 but when I update the mitmproxy I face the following problem: File "C:\dv\QA-BizagiProxy\bizproxy.py", ...
Read more >python asyncio no running event loop - You.com
When dealing with a task, run_until_complete finishing means that the coroutine has finished as well, having either returned a value or raised an...
Read more >Async IO in Python: A Complete Walkthrough
run () , introduced in Python 3.7, is responsible for getting the event loop, running tasks until they are marked as complete, and...
Read more >Event Loop — Python 3.11.1 documentation
Raise a RuntimeError if there is no running event loop. This function can only be called from a coroutine or a callback. New...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Are there any proofs that
asyncio.get_event_loopwill be replaced withasyncio.get_running_loopinasyncio.Queue, for example? I mean this will be refactored to useasyncio.get_running_loop. Deprecating and removing theloopargement is ok, but changing the internal behavior will break a lot of people’s code.The reason is: Queue does not exist without the loop. The current version makes this dependency strict and explicit. Sorry, this is not going to change