From 583abb80277d6ab5c8ad887477c12a3139e6f5f9 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Fri, 3 Mar 2000 23:00:41 +0000 Subject: default to cwd if os.environ['HOME'] does not exist --- Tools/idle/IdleConf.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tools/idle/IdleConf.py b/Tools/idle/IdleConf.py index de208b0..4d6ca4d 100644 --- a/Tools/idle/IdleConf.py +++ b/Tools/idle/IdleConf.py @@ -100,12 +100,16 @@ def load(dir): genplatfile = os.path.join(dir, "config-unix.txt") platfile = os.path.join(dir, "config-%s.txt" % sys.platform) + + try: + homedir = os.environ['HOME'] + except KeyError: + homedir = os.getcwd() for file in (os.path.join(dir, "config.txt"), genplatfile, platfile, - # XXX watch out for KeyError - os.path.join(os.environ['HOME'], ".idle"), + os.path.join(homedir, ".idle"), ): try: f = open(file) -- cgit v0.12