File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,9 @@ use vm::{builtins::PyStrRef, Interpreter};
4
4
5
5
fn py_main ( interp : & Interpreter ) -> vm:: PyResult < PyStrRef > {
6
6
interp. enter ( |vm| {
7
+ // Add local library path
7
8
vm. insert_sys_path ( vm. new_pyobj ( "examples" ) )
8
- . expect ( "add path" ) ;
9
+ . expect ( "add examples to sys. path failed " ) ;
9
10
let module = vm. import ( "package_embed" , None , 0 ) ?;
10
11
let name_func = module. get_attr ( "context" , vm) ?;
11
12
let result = name_func. call ( ( ) , vm) ?;
@@ -15,7 +16,10 @@ fn py_main(interp: &Interpreter) -> vm::PyResult<PyStrRef> {
15
16
}
16
17
17
18
fn main ( ) -> ExitCode {
18
- let interp = vm:: Interpreter :: with_init ( Default :: default ( ) , |vm| {
19
+ // Add standard library path
20
+ let mut settings = vm:: Settings :: default ( ) ;
21
+ settings. path_list . push ( "Lib" . to_owned ( ) ) ;
22
+ let interp = vm:: Interpreter :: with_init ( settings, |vm| {
19
23
vm. add_native_modules ( rustpython_stdlib:: get_module_inits ( ) ) ;
20
24
} ) ;
21
25
let result = py_main ( & interp) ;
You can’t perform that action at this time.
0 commit comments