Skip Navigation

pyo3 async runtime

Hello,

I am trying to wrap some Rust code that uses sea-orm compiled with "runtime-tokio-rustls" feature. I am using the new pyo3 "experimental-async" feature, which AFAIK is based on pyo3_async.

So I get that this is supposed to be runtime-agnostic, and not have two event loops, one for python async and one for rust async.

But, how do I tell pyo3 to use tokio runtime specifically? Or, how do I set up Python asyncio eventloop to use tokio somehow?

Indeed, it seems that it does not use tokio runtime, so I get this error when I invoke the rust async function from Python:

pyo3_runtime.PanicException: this functionality requires a Tokio context
3
3 comments