I'm running Python 3.7.3 and the error is the foll...
# python
I'm running Python 3.7.3 and the error is the following
RuntimeError: asyncio.run() cannot be called from a running event loop
if anyone can point me to the right docs or code, that would be nice 👍
This typically happens when a promise is consumed from a different async event loop from the one it was allocated on. Pulumi uses promises internally and will try to consume the promise generated by
. Can you try it without the
? This should still return a promise, but the call to
already allocates it on the event loop Pulumi is using. So the
shouldn't be necessary, unless I'm missing something.
Hi Joe, Thanks for taking time to answer, it does return a promise when calling directly
(actually it's a
) , we have to resolve it by calling
but this can only be done in a
function, and
in python can't be async. I resolved this issue by creating a new event loop and resolving the promise there. I'm not a python expert but other techniques I've seen involve creating a factory to actually create the object, I choose the separated event loop because I think it is actually more understandable and easy to use for other devs. Thank you.