Closed AlexBdx closed 4 years ago
import nest_asyncio
nest_asyncio.apply()
...
out = asyncio.run(main())
Using the top-level await
from IPython, these lines of code can be replaced with
out = await main()
When I try this it hangs as well, and since it's not using nest_asyncio anymore it must be something in ipywidgets itself..
I have a simple GUI in a Jupyter Notebook with two widgets: a drop down menu with 3 choices and a push button. The desired behavior is:
Using asyncio out of the box does not work in Jupyter Notebook because there is already an event loop running. I tried to user nest_asyncio to solve that issue, and the
RunTimeError
did go away. But instead, the notebook hangs forever. When I click on the push button, nothing happens. I saw there were issues with asyncio.Future in #22, so maybe I am missing something. Any idea how I can leverage nest_asyncio to make this work? Thanks