xpublish icon indicating copy to clipboard operation
xpublish copied to clipboard

asyncio.run() cannot be called from a running event loop

Open pierreloicq opened this issue 1 year ago • 2 comments

Hi, I get this error when executing rest.serve() with

RuntimeError: asyncio.run() cannot be called from a running event loop
sys:1: RuntimeWarning: coroutine 'Server.serve' was never awaited

I have xpublish 0.2.0, xarray 2022.6.0, uvicorn 0.18.3 I don't have asyncio in my conda list, is it expected ?

Actually I need some more explanations on how it works. I already have a code using fastAPI and the uvicorn server installed.

Should I launch uvicorn for rest.serve() to work ? I get this error when server is switched off too (when I run it in spyder in a quite new environment).

Thank you

pierreloicq avatar Sep 02 '22 17:09 pierreloicq

It works now, but I don't know why :-)

pierreloicq avatar Sep 06 '22 08:09 pierreloicq

I got that same error when running ds.rest.serve from notebooks. I resolved it by running all script in one cell and put the magic

%%python3 --bg --proc a --err err --out std

on top. It was only a test so the script i.e. the cell was short.

I actually do not know how to access the output via the variables a or err. if you find out, let me know :)

wachsylon avatar Nov 01 '22 08:11 wachsylon