diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2017-11-25 10:37:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-25 10:37:22 (GMT) |
commit | 8d9bb11d8fcbf10cc9b1eb0a647bcf3658a4e3dd (patch) | |
tree | 96a2d24856b7ea63dfb3992125e3e90447ab52fb /Lib/netrc.py | |
parent | 9d5ec808de2c1359f434cc2fa8378458e4339c96 (diff) | |
download | cpython-8d9bb11d8fcbf10cc9b1eb0a647bcf3658a4e3dd.zip cpython-8d9bb11d8fcbf10cc9b1eb0a647bcf3658a4e3dd.tar.gz cpython-8d9bb11d8fcbf10cc9b1eb0a647bcf3658a4e3dd.tar.bz2 |
bpo-28334: netrc() now uses expanduser() to find .netrc file (GH-4537)
Previously, netrc.netrc() was raised an exception if $HOME is not set.
Authored-By: Dimitri Merejkowsky <dimitri.merejkowsky@tanker.io>
Diffstat (limited to 'Lib/netrc.py')
-rw-r--r-- | Lib/netrc.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/netrc.py b/Lib/netrc.py index baf8f1d..f0ae48c 100644 --- a/Lib/netrc.py +++ b/Lib/netrc.py @@ -23,10 +23,7 @@ class netrc: def __init__(self, file=None): default_netrc = file is None if file is None: - try: - file = os.path.join(os.environ['HOME'], ".netrc") - except KeyError: - raise OSError("Could not find .netrc: $HOME is not set") from None + file = os.path.join(os.path.expanduser("~"), ".netrc") self.hosts = {} self.macros = {} with open(file) as fp: |