Get help from the marimo community

Updated last month

current working directory when python file in subfolder

When I run
uv run marimo edit subfolder/hello.py
and then type

Plain Text
import os
print(os.getcwd())

I'll get
Plain Text
/Users/jan-hendrik/projects/okapi

without the subfoloder.
Therefore my question: Is there a way to start marimo, so that the python cwd is directly in the subfolder?
Attachment
image.png
J
M
3 comments
my current workaround:
Plain Text
cd subfolder
uv run marimo edit hello.py
you would need to cd into the directory. I always use mo.notebook_dir() in all my notebooks so they are compatible wherever they are run (and when run as a script)
Plain Text
import marimo as mo
pl.read_csv(mo.notebook_dir()  / "data" / "my.csv")
Add a reply
Sign up and join the conversation on Discord