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
  • Giooschi@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    9 months ago

    If your goal is to just .await some future that require the Tokio runtime you can use the async-compat crate.