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

set_key creates orphan .env file #480

Open
TheGeeKing opened this issue Aug 15, 2023 · 0 comments · May be fixed by #481
Open

set_key creates orphan .env file #480

TheGeeKing opened this issue Aug 15, 2023 · 0 comments · May be fixed by #481

Comments

@TheGeeKing
Copy link

set_key states "If the .env path given doesn't exist, fails instead of risking creating an orphan .env somewhere in the filesystem".

set_key has no check if the file exists. As it uses rewrite which if path passed is not a file, it creates an empty file.

if not os.path.isfile(path):
        with open(path, mode="w", encoding=encoding) as source:
            source.write("")

if not os.path.isfile(path):

TheGeeKing added a commit to TheGeeKing/python-dotenv that referenced this issue Aug 15, 2023
Changed:
- `set_key` now checks if the `dotenv_path` exists

Fix theskumar#480
@TheGeeKing TheGeeKing linked a pull request Aug 15, 2023 that will close this issue
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 a pull request may close this issue.

1 participant