You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mo.app_meta().mode should be "edit" for marimo export session #12156
Say I have a notebook notebook.py that generates some images.
I run the marimo export session notebook.py to get the json output.
If inside I run the mo.app_meta().mode == "edit" check, it will output yes. But it is weird in this case, because there was no interaction with the browser.
Having mode == "export" would also allow me to have a different execution when run from the cli, for example, to not block on a "run" button.
You can accomplish what you want without making any changes to marimo's repository, by using Python's support for command-line arguments. Here is an example.
Pass a command-line argument to marimo export session. For example, export=true
marimo export session my_nb.py -- -export=true
In your notebook, read the argument vector with sys.argv.
Since you are comfortable with Python, you can also use higher-level APIs should you wish, such as argparse.
Activity
rambip commentedon Nov 29, 2026
I'm not able to add a label to the PR
akshayka commentedon Nov 30, 2026
@rambip, thanks for the feedback.
Pass a command-line argument to
marimo export session. For example,export=trueIn your notebook, read the argument vector with
sys.argv.Since you are comfortable with Python, you can also use higher-level APIs should you wish, such as
argparse.