Python path and executing as a script
hi folks. I'm trying to figure out how Marimo manages paths when used as a library versus being called on the command line, to see if there's anything I need to do to my PYTHONPATH variable when executing a marimo notebook .py file. When I run a file using
marimo run ./folder/path-to-file.py
or marimo edit ./folder/path-to-file.py
things work as expected, but when calling python ./folder/path-to-file.py
some imports are not found. I've created a thread in the django forum outlining it in some more detail:
https://forum.djangoproject.com/t/anyone-had-look-at-using-marimo-with-django/27182/3
We use gitpod in the green web foundation, even with this issued, I've found Marimo useful to merge in to our dev dependencies. Is there a place I should file an issue to track any further investigation at our end to figure out how to run marimo notebooks in a django environment?Django Forum
Anyone had look at using Marimo with Django?
Slight update here. While you can run analysis in an interactive notebook session like so: marimo edit ./analysis/my-analysis-notebook.py And even run a simplified web-app of sorts with marimo run ./analysis/my-analysis-notebook.py I’ve had some struggles running a python script that uses django unattended, like the following: python ./ana...
1 Reply
Hi! Thanks for reporting. There shouldn't be anything you need to do to your PYTHONPATH.
marimo edit
/marimo run
don't do anything special with the path -- they just pick up whatever interpreter the marimo program was started with. So I'm surprised imports aren't found when you run as a script.
I'd be happy look into this. Can you file an issue on GitHub? https://github.com/marimo-team/marimo/issuesGitHub
Issues · marimo-team/marimo
A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git. - Issues · marimo-team/marimo