You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
init_websocket internally takes the default eventloop and expects to run it. This may not be what you or I expect. But it means the current event loop has to not be running when you call that method. This may result in some pretty weird looking bootstrap code on your part. I have a pull request where I try to provide an asyncio friendly interface #102
If you are using nested eventloops as the solution that fix is worse than the problem, It ends up making async python code more magical. By default the eventloop runs a single task at a time and which tasks is currently running can only switch at await keywords. So it is very easy to see where other tasks could be executing and updating some shared variables. With nested eventloop you can have task switches and executing any time you call a blocking function. Which means you need to use asyncio Locks even in code where it appears not to be possible for other tasks to be running due to the lack of an await keyword. This is completely unexpected in existing asyncio code and you will end up having problems with race conditions.
Hello I received following error while running :
async def my_event_handler(e):
message=json.loads(e)
print(message)
matt.init_websocket(my_event_handler)
as a workaround I used following solution from stackoverflow:
https://stackoverflow.com/questions/46827007/runtimeerror-this-event-loop-is-already-running-in-python
The text was updated successfully, but these errors were encountered: