Skip to content

dotenv_load with bad file path doesn't error #164

Description

@bandtank

Dotenv accepts a bad file name as dotenv_path and returns True even though the file could not have been loaded because it doesn't exist. I am now checking for existence of the file ahead of time, but the library really should check this on its own. Libraries that interact with files should throw exceptions when the files are inaccessible.

$ python
Python 3.7.2 (default, Jan 24 2019, 09:21:54) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dotenv
>>> e = dotenv.find_dotenv()
'/home/<user>/repositories/<repo>/.env'
>>> dotenv.load_dotenv(dotenv_path = e)
True
>>> dotenv.load_dotenv(dotenv_path = "/tmp/badFileName")
True
>>> quit()
$ ll /tmp/badFileName
ls: cannot access '/tmp/badFileName': No such file or directory

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions