-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
C-bugSomething isn't workingSomething isn't working
Description
Summary
Windows 11, Rust nightly, symlinks (for ../Lib
) configured, RustPython d8f1d18
Cargo.toml
[package]
name = "frozen_ctypes"
version = "0.1.0"
edition = "2024"
[dependencies]
rustpython-vm = { path = "RustPython/vm", features = ["freeze-stdlib"] }
rustpython-pylib = { path = "RustPython/pylib", features = ["freeze-stdlib"] }
src/main.rs
use rustpython_vm::Interpreter;
use rustpython_vm::AsObject;
fn main() {
let script = "from ctypes import *";
let interpreter = Interpreter::with_init(Default::default(), |vm| {
vm.add_frozen(rustpython_pylib::FROZEN_STDLIB);
});
let _ = interpreter.enter(|vm| {
let scope = vm.new_scope_with_builtins();
vm.run_code_string(scope, script, "<script>".to_owned())
.map(drop)
.map_err(|e| {
let err_str = vm.call_method(e.as_object(), "__str__", ())
.ok()
.and_then(|s| s.downcast::<rustpython_vm::builtins::PyStr>().ok())
.map(|s| s.as_str().to_string())
.unwrap_or_else(|| "<unprintable>".into());
format!("Python error: {}", err_str)
})
}).expect("Failed to run script");
println!("Script executed successfully.");
}
Expected
Script executed successfully
Actual
C:/Users/Admin/.cargo/bin/cargo.exe run --color=always --package frozen_ctypes --bin frozen_ctypes --profile dev
Blocking waiting for file lock on build directory
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.82s
Running `target\debug\frozen_ctypes.exe`
thread 'main' panicked at src\main.rs:25:8:
Failed to run script: "Python error: No module named '_struct'"
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/9982d6462bedf1e793f7b2dbd655a4e57cdf67d4/library\std\src\panicking.rs:697
1: core::panicking::panic_fmt
at /rustc/9982d6462bedf1e793f7b2dbd655a4e57cdf67d4/library\core\src\panicking.rs:75
2: core::result::unwrap_failed
at /rustc/9982d6462bedf1e793f7b2dbd655a4e57cdf67d4/library\core\src\result.rs:1761
3: enum2$<core::result::Result<tuple$<>,alloc::string::String> >::expect<tuple$<>,alloc::string::String>
at C:\Users\Admin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\result.rs:1119
4: frozen_ctypes::main
at .\src\main.rs:25
5: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at C:\Users\Admin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:253
6: core::hint::black_box
at C:\Users\Admin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\hint.rs:482
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\frozen_ctypes.exe` (exit code: 101)
Process finished with exit code 101
Metadata
Metadata
Assignees
Labels
C-bugSomething isn't workingSomething isn't working