lovuikeng
lovuikeng•2w ago

wasm export local file read

exporting notebook to wasm
$ uv tool run marimo@0.10.2 export html-wasm apps.py -o wasm --mode run
serve it on python http server, after loading the index file, caught
This cell raised an exception: FileNotFoundError('[Errno 44] No such file or directory: 'data.csv''
does wasm export support reading local file?
Solution:
It does not at the moment. We have an issue internally tracking this
Jump to solution
7 Replies
Hall
Hall•2w ago
Someone will reply to you shortly. In the meantime, this might help:
Solution
Myles Scolnick
Myles Scolnick•2w ago
It does not at the moment. We have an issue internally tracking this
Myles Scolnick
Myles Scolnick•2w ago
Is difficult since we would need to bundle this And there is a limit of what wasm can support in terms of file size
lovuikeng
lovuikengOP•2w ago
ok, just to confirm, thank you, wasm standalone looks really great feature to explore 🙂
mcaggio
mcaggio•2w ago
not sure if I understood the question correctly, but if you want to make a file available to the pyodide kernel, provided the file is available for download from a url, you can download it to the local wasm kernel filesystem
from pyodide.http import pyfetch

response = await pyfetch("https://raw.githubusercontent.com/caggionim/marimo_rheofit/refs/heads/main/models.py")
with open('models.py', 'wb') as file:
file.write(await response.bytes())
from pyodide.http import pyfetch

response = await pyfetch("https://raw.githubusercontent.com/caggionim/marimo_rheofit/refs/heads/main/models.py")
with open('models.py', 'wb') as file:
file.write(await response.bytes())
mcaggio
mcaggio•2w ago
I have an example in this repository https://github.com/caggionim/marimo_rheofit
GitHub
GitHub - caggionim/marimo_rheofit: testing_marimo_app
testing_marimo_app. Contribute to caggionim/marimo_rheofit development by creating an account on GitHub.
lovuikeng
lovuikengOP•2w ago
thanks, true that reading CSV from URL does work, the intention here is to read from local file path

Did you find this page helpful?