Closed LijieZhang1998 closed 1 year ago
Try adding -B
before /path/to/hello.py
. It's likely that Python is trying to compile the standard library to .pyc
files, which it may not have permission to do.
I tried this. It still failed with the same error.
wasmtime run --mapdir=/opt/wasi-python/lib/python3.13::/
opt/wasi-python/lib/python3.13 --mapdir=/tmp::/tmp -- wasi-python3.13.wasm -B /path/to/hello.py
I see now. You need to add /path/to
to your directory mappings. Try adding --mapdir=/::/path/to
.
ahh. I use --dir
to make it work. This is the workable command, where testfiles
folder is located in the same folder as wasi-python3.13.wasm
is.
wasmtime run --mapdir=/opt/wasi-python/lib/python3.13::/opt/wasi-python/lib/python3.13 --dir=. -- wasi-python3.13.wasm -B ./testfiles/hello.py
Thank you very much.
Just as a side note, while this repo is still functional, there is more formal work being done on creating Python Wasm components. You may want to check out https://github.com/dicej/componentize-py.
Hi, I followed the instruction to build wasi-python. It's working. My built file is wasi-python3.13.wasm. I created a sample hello python file(just one line
print('hello')
) in the docker container. Then I ran this command to execute it in the docker container.I got an error
wasi-python3.13.wasm: can't open file '/path/to/hello.py': [Errno 76] Capabilities insufficient
.Does anybody have any idea? As you may see, my python version is 3.13.
Appreciate your help.