when I run `dagit` from the terminal, it fails to ...
# ask-community
r
when I run
dagit
from the terminal, it fails to load the .env file situated in the directory and crashes due to the missing variables. I only just noticed this because I normally run it via VSCode's launch/debugger interface and there everything loads perfectly! That's despite it more or less just calling the
dagit
command:
Copy code
/usr/bin/env /home/rasmus/.cache/pypoetry/virtualenvs/orchestration-4tQjH8vh-py3.9/bin/python /home/rasmus/.vscode-server/extensions/ms-python.python-2023.2.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 44961 -- -m dagit
is this a race condition of some sort? failure to find the .env file, maybe due to it looking in the wrong directory? Or is the .env not supposed to be loaded in time before the workspace.yaml?
d
Hi Rasmus - right now the .env file is only loaded in the process where your code is running (i.e. it wouldn't pick up env vars in your dagster.yaml file). Maybe it's working in VSCode because there's something else besides Dagster that's aware of the .env file and loading it in that case?
r
hi, thanks for the reply - on reflection that was also my best guess when I revisited the problem today, although still not quite sure what is doing the loading. Thanks!