Files
RustPython/examples/freeze/main.rs
Christoph Herzog bca704ed99 Examples Wording Issue - relative <=> relevant
Just a simple drive-by fix for the wording in the freeze example
2021-09-09 13:53:46 +02:00

22 lines
682 B
Rust

use rustpython_vm as vm;
fn main() -> vm::PyResult<()> {
vm::Interpreter::default().enter(run)
}
fn run(vm: &vm::VirtualMachine) -> vm::PyResult<()> {
let scope = vm.new_scope_with_builtins();
// the file parameter is relative to the directory where the crate's Cargo.toml is located, see $CARGO_MANIFEST_DIR:
// https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates
let module = vm::py_compile!(file = "examples/freeze/freeze.py");
let res = vm.run_code_obj(vm.new_code_object(module), scope);
if let Err(err) = res {
vm::exceptions::print_exception(&vm, err);
}
Ok(())
}