Skip to content

Instantly share code, notes, and snippets.

@korakot
Last active January 3, 2024 02:15
Show Gist options
  • Save korakot/f1d835321fa14075227add61b90debb3 to your computer and use it in GitHub Desktop.
Save korakot/f1d835321fa14075227add61b90debb3 to your computer and use it in GitHub Desktop.
Use asyncio (async) in Colab
import nest_asyncio
nest_asyncio.apply()
@korakot
Copy link
Author

korakot commented Aug 10, 2022

This comment from mohamed mofid is missing?

I think you just make a new event loop and pass it to nest_asyncio.apply() the start using it like this:

    self.loop = asyncio.new_event_loop()
    nest_asyncio.apply(self.loop)
    asyncio.set_event_loop(self.loop)

I found that in GitHub:
https://github.com/erdewit/nest_asyncio/blob/master/tests/nest_test.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment