Skip to content

Print warning on malformed lines in .env file - #211

Merged
bbc2 merged 2 commits into
theskumar:masterfrom
bbc2:invalid-dotenv-warnings
Jan 13, 2020
Merged

bbc2 merged 2 commits into
theskumar:masterfrom
bbc2:invalid-dotenv-warnings

Conversation

@bbc2

@bbc2 bbc2 commented Nov 3, 2019

Copy link
Copy Markdown
Collaborator

This prints a warning such as the following on stderr (logging.warning) when part of the .env file can't be parsed:

Python-dotenv could not parse statement starting at line 2

I think it's OK to use the "warning" level because such an error means that something should be fixed by the user.

Note that Python-dotenv will continue to parse the file and won't interfere in any other way with the application using it.

I've also added some commits to fix the CI (linting in the code and the manifest).

Fixes #204

@bbc2
bbc2 requested a review from theskumar November 3, 2019 13:59
@bbc2
bbc2 force-pushed the invalid-dotenv-warnings branch from 9bd5339 to 4d8aa19 Compare November 3, 2019 14:12
@coveralls

coveralls commented Nov 3, 2019 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-3.4%) to 84.461% when pulling e850e21 on bbc2:invalid-dotenv-warnings into 3576225 on theskumar:master.

@bbc2

bbc2 commented Dec 17, 2019

Copy link
Copy Markdown
Collaborator Author

@theskumar Hi! I understand you might not have a lot of time to review code. Do you mind if I go ahead and merge this and other PRs without review?

bbc2 added 2 commits December 21, 2019 19:51
If a line can't be parsed (e.g. `FOO: BAR` is invalid), it is printed as
a warning on stderr.

As usual, after such an error, Python-dotenv tries to parse the rest of
the file and the application can use the successfully parsed variable
bindings.
@bbc2
bbc2 force-pushed the invalid-dotenv-warnings branch from 4d8aa19 to e850e21 Compare December 21, 2019 18:58
@theskumar

Copy link
Copy Markdown
Owner

@bbc2 Due to some personal commitments I'm not able to pay as much attention to this project as it deserves. I won't like to hold onto any requests due to my unavailability. Please feel free to merge without my review if you are confident about it :)

@theskumar theskumar left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it!!

@bbc2
bbc2 merged commit 723809f into theskumar:master Jan 13, 2020
@bbc2
bbc2 deleted the invalid-dotenv-warnings branch January 13, 2020 19:42
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

Successfully merging this pull request may close these issues.

Malformed .env loads silently

3 participants