mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
default to cwd if os.environ['HOME'] does not exist
This commit is contained in:
parent
daca630e40
commit
583abb8027
1 changed files with 6 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue