diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-03-03 23:00:41 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-03-03 23:00:41 (GMT) |
commit | 583abb80277d6ab5c8ad887477c12a3139e6f5f9 (patch) | |
tree | c6d935a352bc4040dd22c119794141ca05d53608 /Tools/idle | |
parent | daca630e4058fcdc5cb4397b5e49329e9b07776b (diff) | |
download | cpython-583abb80277d6ab5c8ad887477c12a3139e6f5f9.zip cpython-583abb80277d6ab5c8ad887477c12a3139e6f5f9.tar.gz cpython-583abb80277d6ab5c8ad887477c12a3139e6f5f9.tar.bz2 |
default to cwd if os.environ['HOME'] does not exist
Diffstat (limited to 'Tools/idle')
-rw-r--r-- | Tools/idle/IdleConf.py | 8 |
1 files 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) |