I try to count time using %time
in Jupyter-notebook, and some SyntaxError just makes me confused.
Here is a simple code that can demonstrate the problem
import asyncio
async def main():
print(1)
%time asyncio.run(main())
which throws RuntimeError: asyncio.run() cannot be called from a running event loop
according to asyncio.run() cannot be called from a running event loop, I change the code like this
import asyncio
async def main():
print(1)
%time await main()
and it throws SyntaxError: 'await' outside function
when I remove the %time
part the code works fine.
Did jupyter not support %time
with asyncio functions?