Issue
I am trying to learn asyncio. I have this coroutine:
co_get_json = <coroutine object Client.get_json at 0x7fcd5dff9d40>
It has a corresponding non-async version get_json
.
I then typed await co_r
in IPython. Now anytime I run get_json
(the non async version) I get the error RuntimeError: This event loop is already running
.
How do I close the event loop?
>>>asyncio.get_event_loop()
<_UnixSelectorEventLoop running=True closed=False debug=False>
.
If I type asyncio.get_event_loop().stop()
, my IPython kernel dies. I've tried restarting to no avail.
Solution
After reading the IPython docs, I finally fixed it by installing nest-asyncio
and running nest_asyncio.apply()
. Hopefully this will help future users!
Answered By - j7skov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.