current working directory when python file in subfolder
At a glance
The community member is trying to run a Python script in the subfolder directory using the marimo tool, but the current working directory (cwd) is set to the parent directory /Users/jan-hendrik/projects/okapi. The community member wants to know if there is a way to start marimo so that the Python cwd is directly in the subfolder.
In the comments, community members suggest two workarounds:
Manually change the directory to the subfolder before running the marimo command: cd subfolder; uv run marimo edit hello.py
Use the mo.notebook_dir() function from the marimo library to get the directory of the current notebook, which ensures compatibility regardless of the cwd.
There is no explicitly marked answer in the comments.
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)