3👍
✅
The problem is that you treat the env file as a shell one.
python-dotenv readme states that you can use export
in your .env
file, which is ignored by the package. This so that the env vars could alternatively be set by calling source .env
from shell.
However, you can’t run shell scripts that way. When I tried to load your example, I got this message:
Python-dotenv could not parse statement starting at line 2
True
After removing the echo
line, I got just True
as a response and PYTHONSTARTUP
was set.
There’s another issue, however, as you depend on shell scripting in the value of PYTHONSTARTUP
as well. It’s set to
'PYTHONSTARTUP': '`pwd`/.pythonrc.py'
Not what you’d expect. This should work:
export PYTHONSTARTUP2=${PWD}/.pythonrc.py
Source:stackexchange.com