Improve error message for `get` and `list` commands when env file can't be opened by bbc2 · Pull Request #441 · theskumar/python-dotenv

@bbc2

The error message would previously be confusing. For example, `dotenv -f
. list` would print:

    Error: Invalid value: Path "." does not exist.

Instead, we now print:

    Error opening env file: [Errno 21] Is a directory: '.'

I used this opportunity to slightly refactor the I/O code (e.g. fewer
system calls and possible race conditions) for those two subcommands
(`get` and `list`).