Skip to content

Import error when initializing interpreter in a wasm_bindgen function #3749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
terror opened this issue May 27, 2022 · 5 comments
Open

Import error when initializing interpreter in a wasm_bindgen function #3749

terror opened this issue May 27, 2022 · 5 comments

Comments

@terror
Copy link

terror commented May 27, 2022

When initializing an interpreter and compiling to wasm, we are met with the following error in the browser console:

ImportError: Cannot import builtin module _thread

Our simple initialization code:

#[wasm_bindgen]
pub fn run() {
  let interpreter = Interpreter::without_stdlib(Default::default());
}

We are using rustpython as a git dependency in our project, are we missing something important here?

@youknowone
Copy link
Member

maybe features? would you try one of:

  • --no-default-features --features freeze-stdlib
  • --no-default-features --features freeze-stdlib,stdlib

@terror
Copy link
Author

terror commented May 27, 2022

maybe features? would you try one of:

  • --no-default-features --features freeze-stdlib
  • --no-default-features --features freeze-stdlib,stdlib

Doesn't seem to work either.

I've reproduced the issue in a separate repo, so this might give more insight into the problem:

https://github.com/terror/rustpython-bug

@youknowone
Copy link
Member

@coolreader18 do you have advice? i also want to learn the best way to do this

@youknowone
Copy link
Member

@coolreader18 would you check this one please?

@youknowone
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants