-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
No running event loop #448
Comments
I was able to use janus v0.4.0 successfully but upgrading to v1.0.0 results in the same code raising |
From my understanding it needs an existing asyncio loop in main thread in order to work. |
actually, I've found this https://github.com/dano/aioprocessing it has a queue that works like a charm. <3 |
I suspect problem as described here #438 |
Any progress of this Issue? Same problem when I creating a queue in the sync function and pass it to the async one. |
Simple way to create janus queue in synchronous code (Python 3.6+). import asyncio
import janus
def init_janus_queue(loop: asyncio.AbstractEventLoop):
async def create_queue():
return janus.Queue()
return loop.run_until_complete(create_queue())
#create your own loop before initializing, note that the loop must remain the same afterword
#loop = asyncio.new_event_loop()
#asyncio.set_event_loop(loop)
res_queue = init_janus_queue(loop) |
I am having trouble creating the janus Queue outside of asyncio. It requires me to make dummy background tasks to just create the object, since not running loop exists I am wonder if this could be lazy or allow the loop to be passed in the constructor? It makes sync to async code a tad harder.
The text was updated successfully, but these errors were encountered: