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
I'm not familiar with
pyo3_async
, but I don't think you can force Pythonasyncio
to use the Tokio event loop. This is discussed in the documentation of a different PyO3 async crate,pyo3-asyblncio
: https://docs.rs/pyo3-asyncio/latest/pyo3_asyncio/#why-two-event-loops