fix: "Download as .py" in WASM run-mode exports#9268
fix: "Download as .py" in WASM run-mode exports#9268mscolnick merged 1 commit intomarimo-team:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Fixes “Download as .py” for marimo export html-wasm --mode run by making the WASM bridge read notebook source from the embedded <marimo-code> element when running in read-mode, avoiding the read-mode SaveWorker stub that throws “Not implemented”.
Changes:
- Import and use
domElementFileStoreinPyodideBridge.readCode()whengetInitialAppMode() === "read". - Keep existing SaveWorker-based
readNotebook()path for non-read modes.
7bdc2ea to
31deb83
Compare
31deb83 to
81e5a16
Compare
|
Deployment failed with the following error: |
|
Thanks @moble. On the implementation, is it possible to implement this in the |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
81e5a16 to
3b05061
Compare
Yeah, I wasn't sure that it wouldn't mess up something else. But I've switched to that now. Thanks. |
📝 Summary
(I got a lot of help writing the test from Claude.)
When a notebook is exported with
marimo export html-wasm --mode run, the resulting HTML embeds the notebook source in a<marimo-code>element, but the "Download as .py" menu item fails with "Failed to read code / Not implemented".The reason is that
PyodideBridge.readCode()callsthis.saveRpc.readNotebook(). In read mode,getSaveWorker()returns a stub where every method isthrowNotImplemented, which is what causes that failure.This PR fixes the problem by checking in
readCodeif the app mode is"read", and if so it just reads the file fromdomElementFileStore.📋 Pre-Review Checklist
✅ Merge Checklist