fix: check .env in current dir with isfile instead of exists

This prevents cases in which an `.env` directory exists, for example
in Python projects with a local virtual environment, and then
dotenv gets passed the directory path as input.
This commit is contained in:
Sebastian Ramirez Magri 2021-02-23 17:14:46 +01:00 committed by Muayyad Alsadi
parent 08dd36f4c1
commit 75a63df954

View File

@ -876,7 +876,7 @@ class PodmanCompose:
dotenv_path = os.path.join(dirname, ".env")
if os.path.exists(dotenv_path):
if os.path.isfile(dotenv_path):
with open(dotenv_path, 'r') as f:
dotenv_ls = [l.strip() for l in f if l.strip() and not l.startswith('#')]
dotenv_dict = dict([l.split("=", 1) for l in dotenv_ls if "=" in l])