diff options
-rw-r--r-- | Lib/netrc.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/netrc.py b/Lib/netrc.py index 3f1c7c3..b78d4d8 100644 --- a/Lib/netrc.py +++ b/Lib/netrc.py @@ -22,7 +22,10 @@ class NetrcParseError(Exception): class netrc: def __init__(self, file=None): if not file: - file = os.path.join(os.environ['HOME'], ".netrc") + try: + file = os.path.join(os.environ['HOME'], ".netrc") + except KeyError: + raise IOError("Could not find .netrc: $HOME is not set") fp = open(file) self.hosts = {} self.macros = {} |