summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2013-05-06 15:39:31 +0200
committerMark Dickinson <dickinsm@gmail.com>2013-05-06 15:39:31 +0200
commit022cb1648e27d754be23e05455c2fd9b33320b1f (patch)
treed9cea4ff82b21a5a7e8da252a492c5c82172eb4b
parent5930b96e410cea9b9ac3ac4b0146de765bd8506b (diff)
downloadcpython-022cb1648e27d754be23e05455c2fd9b33320b1f.tar.gz
Issue #5845: avoid an exception at startup on OS X if no .editrc file exists.
-rw-r--r--Lib/site.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py
index f13d4b4e4a..96a4bef71e 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -478,7 +478,15 @@ def enablerlcompleter():
readline.parse_and_bind('bind ^I rl_complete')
else:
readline.parse_and_bind('tab: complete')
- readline.read_init_file()
+
+ try:
+ readline.read_init_file()
+ except OSError:
+ # An OSError here could have many causes, but the most likely one
+ # is that there's no .inputrc file (or .editrc file in the case of
+ # Mac OS X + libedit) in the expected location. In that case, we
+ # want to ignore the exception.
+ pass
history = os.path.join(os.path.expanduser('~'), '.python_history')
try: