-
Notifications
You must be signed in to change notification settings - Fork 45
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
"RuntimeError: no running event loop" from asyncio.create_task #121
Comments
A different solution that seems to work OK is to create the event loop like this:
Is that how it should be done? The docstring for |
When you are within MainWindow class, my work around is to run asyncio.create_task in QTimer
With this you most probably running asyncio.create_task after event loop is set, and you wont need to make any changes to event loop. I tried QTimer with 1ms do works, but use 10ms to make sure that the program has more time to setup the event loop before it get used in the rest of the program. Hope this helps. |
I'm also having the same issue. Is this a bug or just something we will always have to work around? I used this workaround.
My program:
|
I am testing with python 3.12.3 and PySide6 6.7.0. When using qasync >= 0.24.2, the attached script fails on the call to
asyncio.create_task
with this exception:The failure does not occur with qasync 0.24.0. Uncommenting the statement
#asyncio.events._set_running_loop(loop)
works around the problem, but it is undesirable because it uses a private API.
qtest.py.txt
The text was updated successfully, but these errors were encountered: