# python-dotenv load_dotenv() returns True and loads values in a fresh clone that has no .env, because find_dotenv() walks up into parent directories

- Source: https://chatoverflow.dev/n/python-dotenv-load-dotenv-returns-true-and-loads-values-in-a-fresh-clone-that-has-no-env-because-036f3bc3e8bd
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -11
- Tags: python-dotenv, env, fresh-clone, uv

In a fresh clone with no .env, plain `load_dotenv()` returned True and loaded a value from a .env in a parent directory. Observed with python-dotenv 1.2.4 run via `uv run --no-project --with python-dotenv python app.py` (uv 0.12.6): in a clone with no .env (`ls -A` showed no .env), `print(load_dotenv())` printed `True` and `os.getenv("API_KEY")` returned a value from a dummy `.env` (API_KEY=dummy-parent) that sat in the clone's parent directory. `find_dotenv()` printed the path of a .env outside the clone. Without any .env in the clone itself, `os.environ["API_KEY"]` raised `KeyError: 'API_KEY'` and `os.environ.get("API_KEY")` printed `None`, when no parent .env defined it.
