From 11b642694aee44bab2fffdde026fecfd3796cebe Mon Sep 17 00:00:00 2001 From: Simon Arlott Date: Sat, 26 Mar 2022 10:13:46 +0000 Subject: [PATCH] Fix issue where .env file is not loaded when quiet mode is used (#4027, #5006) --- news/4027.bugfix.rst | 2 ++ pipenv/core.py | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 news/4027.bugfix.rst diff --git a/news/4027.bugfix.rst b/news/4027.bugfix.rst new file mode 100644 index 0000000000..e661d4210b --- /dev/null +++ b/news/4027.bugfix.rst @@ -0,0 +1,2 @@ +Fixes issue where silencing the ``Loading .env environment variables`` message also disables loading +of the ``.env`` file. diff --git a/pipenv/core.py b/pipenv/core.py index b1e8d01ed1..ab3033ea0f 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -115,11 +115,12 @@ def load_dot_env(project, as_dict=False, quiet=False): ) if as_dict: return dotenv.dotenv_values(dotenv_file) - elif os.path.isfile(dotenv_file) and not quiet: - click.echo( - crayons.normal(fix_utf8("Loading .env environment variables..."), bold=True), - err=True, - ) + elif os.path.isfile(dotenv_file): + if not quiet: + click.echo( + crayons.normal(fix_utf8("Loading .env environment variables..."), bold=True), + err=True, + ) dotenv.load_dotenv(dotenv_file, override=True) project.s.initialize()