Replies: 3 comments
-
What is wrong with using |
Beta Was this translation helpful? Give feedback.
-
You would probably have to use sys.argv to pass the command line parameters to marimo. def sh_cmd(cmdln):
if not cmdln:
return
saved_argv=sys.argv
sys.argv=shlex.split(cmdln)
cmd,*args=sys.argv
try:
if 'clone'==cmd: clone_selected(src=os.getcwd(),dst=cloned_packages_path,selected=args,logging=True);return 0
elif 'ls' ==cmd: print('\n',' \n '.join(map(shlex.quote,sorted(os.listdir(*args)))),'\n'); return 0
elif 'cd' ==cmd: os.chdir(*args); return 0
elif 'help' ==cmd: print(help_text(),end='\n\n')
elif 'quit' ==cmd: sys.exit()
elif 'exit' ==cmd: sys.exit()
else:
try: runpy.run_module(cmd,run_name='__main__')
except Exception as e: raise e
except BaseException: pass
return 0
finally:
sys.argv=saved_argv I guess you could just use this routine, may be get rid of the shlex.split call, and pass the argv list directly to this function. |
Beta Was this translation helpful? Give feedback.
-
Checkout https://docs.marimo.io/guides/deploying/programmatically/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Within a python script, I'd like to run a marimo notebook as an application (i.e., the equivalent of
marimo run notebook.py
), but I haven't been able to find a standard, public facing way of doing this within marimo?I know this can be done using
subprocess
, but I'd like to avoid this.The one way I know how to do this within marimo depends on the private
_cli
module:marimo._cli.cli.main(["run", "notebook.py"])
Beta Was this translation helpful? Give feedback.
All reactions