Get help from the marimo community

Updated 2 weeks ago

magic commands replacement

I need to run this cell to authenticate:

%%capture cap
%run ../cacheb/cacheb-authentication.py

(It is to access to satellite data on the EU Destination Earth platform)

Marino does not support magic commands. While I may have found a solution for the %%capture I have not been able to find a substitution for the %run.

Any help is highly appreciated.

Thanks
l
r
S
9 comments
What is in the auth script? You could import the code you have there in marimo (from cacheb_authentication import *) and authenticate from marimo?

You might need to change a couple of things in your project to make it work
Also there’s a section for magics replacements for Jupyter users in the marimo docs, let me find it
How do I import the code and authenticate? And I have looked at the migrate section. It does include capture but not run.
It depends what is in your script, is it just functions? Or is there an if __name__ == “__main__”:?
just chiming in, although I think @lucharo 's suggestion is good!

I believe %run is just subprocess.run
Plain Text
import subprocess

subprocess.run(["python", "../cacheb/cacheb-authentication.py"])
True that! If you don’t want to overcomplicate things, that would work, thanks @Shahmir
Does that apply to when double magic (%%) as well?
Yes line and cell magic (% and %%) often operate the same operations
Add a reply
Sign up and join the conversation on Discord