-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
The expected behavior of the load_dotenv()
is to fall back to the behavior of the python-dotenv
library, if the DOTENV_KEY
environment variable is not set, as suggested in the function comments.
The python-dotenv
library allows a non-existing .env
file, and load_dotenv()
returns False
without raising an error in such a case. However, due to src/dotenv_vault/main.py#L67-L68, the behavior differs:
dotenv_path = dotenv.find_dotenv(usecwd=True)
stream = open(dotenv_path) if not stream else stream
Since dotenv.find_dotenv(usecwd=True)
returns ''
in the non-existing .env
file case, the following open(dotenv_path)
raises FileNotFoundError
. Hence, this differs from the python-dotenv
's behavior, contradicting the statement "falls back to the behavior of the python-dotenv library."
Metadata
Metadata
Assignees
Labels
No labels