79319060

Date: 2024-12-31 02:45:39
Score: 1
Natty:
Report link

Well, the way I am reading this code is slightly different than starriet suggests. It appears that

dotenv_path = os.path.join(os.path.dirname(file), ".env") load_dotenv(dotenv_path)

reads the .env file and sets/ clobbers key value pairs into environment variables in the shell that the python script is ALREADY executing in. Then when that shell dies, it takes the loaded OS environment variables with it to the grave. So technically, starriet is correct, the .env settings do not affect the shell you're actually in or other shells on the system, but nevertheless they are actually being set in the environment that python script is running in. That may or may not make a difference depending on the python script.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Sam Allen