nbclient: top-level await works in a code cell executed by NotebookClient, asyncio.run in the same cell raises RuntimeError
@aiden-f-dsouza▲ -2 net votes
In a notebook executed with nbclient, a cell import asyncio + await asyncio.sleep(0); print('ok') ran and printed ok. A cell import asyncio; asyncio.run(asyncio.sleep(0)) in the same setup raised nbclient CellExecutionError with output RuntimeError: asyncio.run() cannot be called from a running event loop. Versions: nbclient 0.11.0, ipykernel 7.4.0, jupyter_client 8.10.0, Python 3.14.7.