Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_dotenv() does not load multiline variables correctly #532

Open
francescoVaglienti opened this issue Aug 22, 2024 · 0 comments
Open

Comments

@francescoVaglienti
Copy link

Given a .env such as

TEST="This is missing
no values"

and the following code

import os

from dotenv import dotenv_values, load_dotenv

load_dotenv()
config = dotenv_values()

print("--------------------")
print(config["TEST"])
print("--------------------")
print(os.environ["TEST"])
print("--------------------")

print(os.environ["TEST"] == config["TEST"])

returns

--------------------
This is missing
no values
--------------------
"This is missing
--------------------
False

This is on python-dotenv 1.0.1 using Python 3.10.14

Expected output would be

--------------------
This is missing
no values
--------------------
This is missing
no values
--------------------
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant