Skip to content

Automatically set RUSTPYTHONPATH for Windows #2659

Open
@oroppas

Description

@oroppas

I wonder if anyone has the same issue.
RustPython works perfectly fine on Linux, but not on Windows:

C:\home\ryuta\packages\rustpython\rustpython>cargo run --features ssl --release
    Finished release [optimized] target(s) in 1.53s
     Running `target\release\rustpython.exe`
Error in sys.excepthook:
lost sys.stderr
RuntimeError: lost sys.stderr
Original exception was:
lost sys.stderr
ModuleNotFoundError: No module named '_codecs'
thread 'main' panicked at 'initializiation failed; exception backtrace above', vm\src\vm.rs:778:13
stack backtrace:
   0:     0x7ff73f74809e - std::backtrace_rs::backtrace::dbghelp::trace
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
   1:     0x7ff73f74809e - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff73f74809e - std::sys_common::backtrace::_print_fmt
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:67
   3:     0x7ff73f74809e - std::sys_common::backtrace::_print::{{impl}}::fmt
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:46
   4:     0x7ff73f76246c - core::fmt::write
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\core\src\fmt\mod.rs:1092
   5:     0x7ff73f741de8 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\io\mod.rs:1572
   6:     0x7ff73f74ae1d - std::sys_common::backtrace::_print
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:49
   7:     0x7ff73f74ae1d - std::sys_common::backtrace::print
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:36
   8:     0x7ff73f74ae1d - std::panicking::default_hook::{{closure}}
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:208
   9:     0x7ff73f74a8e9 - std::panicking::default_hook
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:225
  10:     0x7ff73f74b4c3 - std::panicking::rust_panic_with_hook
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:591
  11:     0x7ff73f74b071 - std::panicking::begin_panic_handler::{{closure}}
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:497
  12:     0x7ff73f7489bf - std::sys_common::backtrace::__rust_end_short_backtrace<closure-0,!>
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:141
  13:     0x7ff73f74afc9 - std::panicking::begin_panic_handler
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:493
  14:     0x7ff73f9199cc - std::panicking::begin_panic_fmt
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:435
  15:     0x7ff73ef8cbdd - rustpython_vm::vm::VirtualMachine::_py_panic_failed::hedd4e530ce27e16e
  16:     0x7ff73ef8ccd9 - rustpython_vm::vm::VirtualMachine::_py_panic_failed::hedd4e530ce27e16e
  17:     0x7ff73ef87e85 - rustpython_vm::vm::VirtualMachine::initialize::h78d918405c50919e
  18:     0x7ff73ed07fd4 - rustpython::run::hb0f380f0ab9a5bb2
  19:     0x7ff73ed02aa9 - core::ptr::drop_in_place<rustpython_vm::pyobject::PyLease<rustpython_vm::builtins::pytype::PyType>>::h64d56ababda4a96e
  20:     0x7ff73ed01ae6 - std::sys_common::backtrace::__rust_begin_short_backtrace::h4fa136964e9a80d8
  21:     0x7ff73ed02aec - std::rt::lang_start::{{closure}}::h40e656a3d375a977
  22:     0x7ff73f74b7a7 - core::ops::function::impls::{{impl}}::call_once
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\library\core\src\ops\function.rs:280
  23:     0x7ff73f74b7a7 - std::panicking::try::do_call
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:379
  24:     0x7ff73f74b7a7 - std::panicking::try
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:343
  25:     0x7ff73f74b7a7 - std::panic::catch_unwind
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panic.rs:431
  26:     0x7ff73f74b7a7 - std::rt::lang_start_internal
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\rt.rs:51
  27:     0x7ff73ed02ad7 - main
  28:     0x7ff73f909e24 - invoke_main
                               at D:\agent\_work\10\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  29:     0x7ff73f909e24 - __scrt_common_main_seh
                               at D:\agent\_work\10\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  30:     0x7ffa59be7c24 - BaseThreadInitThunk
  31:     0x7ffa5b9ed721 - RtlUserThreadStart
error: process didn't exit successfully: `target\release\rustpython.exe` (exit code: 101)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions