Notebook: asyncio.run() fails in the notebook

Created on 3 Jan 2019  路  3Comments  路  Source: jupyter/notebook

Problem

I cannot run in the notebook a demo from the asyncio docs:

2019-01-02 23_08_03-untitled

Observation

It does seem to run in ipython:

2019-01-02 23_06_19-cmder

Setup

I've installed a new everything on a fresh install of Windows 10.
I am running Python 3.7 via Anaconda 2018.12.

conda                     4.5.12                   py37_0
ipykernel                 5.1.0            py37h39e3cac_0
ipython                   7.2.0            py37h39e3cac_0
jupyter                   1.0.0                    py37_7
jupyter_client            5.2.4                    py37_0
notebook                  5.7.4                    py37_0

Most helpful comment

Yes, it is a known limitation.
You need to use things like nest-async-io. This is documented here.

You should be able to just await main()

All 3 comments

cc @Carreau

Yes, it is a known limitation.
You need to use things like nest-async-io. This is documented here.

You should be able to just await main()

I'm going to close as I'm not sure there is much we can do as nesting event loop is a bad idea.
Feel free to keep commenting or ask for a re-open.

Was this page helpful?
0 / 5 - 0 ratings