-
In Rust, I have a piece of Python code. I'd like to use pyo3::prelude::*;
use pyo3::types::PyDict;
#[pyfunction]
fn foo() -> PyResult<()> {
let code = CString::new("a = 1").unwrap();
Python::with_gil(|py| {
let locals = PyDict::new(py);
py.run(&code, Some(&locals), Some(&locals))?;
Ok(())
})
} The culprit seems to be the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
That's not something that could or should work. To put it into perspective, you couldn't write a |
Beta Was this translation helpful? Give feedback.
I think I can just fill a dictionary in rust, return it, and
.update()
globals()
in Python.