awestlake87 / pyo3-asyncio

Other
300 stars 45 forks source link

Can `async main()` return a Result error type other than `PyErr`? #99

Open marshallpierce opened 1 year ago

marshallpierce commented 1 year ago

Returning something like anyhow::Error doesn't work, due to this bound:

#[pyo3_asyncio::tokio::main]
async fn main() -> anyhow::Result<()> {
...

Is there a way around this? In this case, is the best available option to enable PyO3's anyhow feature and convert that way?

🌍 Environment