Skip to content
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

Broken http example: import error from poll_loop.py: StreamErrorClosed #82

Closed
jpwarren opened this issue Apr 10, 2024 · 1 comment · Fixed by #83
Closed

Broken http example: import error from poll_loop.py: StreamErrorClosed #82

jpwarren opened this issue Apr 10, 2024 · 1 comment · Fixed by #83

Comments

@jpwarren
Copy link

Attempting an example for the first time, and it looks like there's a typo in the example code.

I run componentize-py -d ../../wit -w wasi:http/[email protected] componentize app -o http.wasm and get this traceback:

Traceback (most recent call last):
  File "/home/daedalus/src/wasm-experiments/.venv/bin/componentize-py", line 8, in <module>
    sys.exit(script())
AssertionError: Traceback (most recent call last):
  File "/0/app.py", line 10, in <module>
    import poll_loop
  File "/bundled/poll_loop.py", line 17, in <module>
    from proxy.imports.streams import StreamErrorClosed, InputStream
ImportError: cannot import name 'StreamErrorClosed' from 'proxy.imports.streams' (/world/proxy/imports/streams.py). Did you mean: 'StreamError_Closed'?

It looks like bundled/poll_loop.py does indeed try to import and use StreamErrorClosed instead of StreamError_Closed, but when I try to make the change locally (so I can maybe file a PR), it doesn't appear to fix the error.

I clearly don't understand how Python imports work with wasmtime and/or componentize-py. What am I missing? Is it pulling in the import from another path or a prebuilt module somewhere?

No rush, just wanted to start learning about wasm and coming from my background with Python seemed a reasonable entry point.

dicej added a commit that referenced this issue Apr 10, 2024
Also, re-bundle `bundled` directory if any of its files change.

Fixes #82

Signed-off-by: Joel Dice <[email protected]>
@dicej dicej mentioned this issue Apr 10, 2024
@dicej
Copy link
Collaborator

dicej commented Apr 10, 2024

Thanks so much for reporting this @jpwarren. This is a good reminder that (per #15), we need to be testing all the examples in CI. I've been doing spot checks of one or two examples periodically, but clearly I missed this one.

You were right about editing bundled/poll_loop.py, but the build.rs script that pulls it into the componentize-py binary wasn't smart enough to re-run when files under the bundled directory change, which I've just fixed. I've also fixed the example and tested all the other examples: #83

@dicej dicej closed this as completed in #83 Apr 10, 2024
dicej added a commit that referenced this issue Apr 10, 2024
Also, re-bundle `bundled` directory if any of its files change.

Fixes #82

Signed-off-by: Joel Dice <[email protected]>
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

Successfully merging a pull request may close this issue.

2 participants