Executes one or more Python statements in the given context. If `globals` is `None`, it defaults to Python module `__main__`. If `locals` is `None`, it defaults to the value of `globals`.
(
self,
code: &str,
globals: Option<&PyDict>,
locals: Option<&PyDict>,
)
| 263 | /// If `globals` is `None`, it defaults to Python module `__main__`. |
| 264 | /// If `locals` is `None`, it defaults to the value of `globals`. |
| 265 | pub fn run( |
| 266 | self, |
| 267 | code: &str, |
| 268 | globals: Option<&PyDict>, |
| 269 | locals: Option<&PyDict>, |
| 270 | ) -> PyResult<()> { |
| 271 | self.run_code(code, ffi::Py_file_input, globals, locals)?; |
| 272 | Ok(()) |
| 273 | } |
| 274 | |
| 275 | /// Runs code in the given context. |
| 276 | /// `start` indicates the type of input expected: |