]> granicus.if.org Git - python/commitdiff
Issue #5845: avoid an exception at startup on OS X if no .editrc file exists.
authorMark Dickinson <dickinsm@gmail.com>
Mon, 6 May 2013 13:39:31 +0000 (15:39 +0200)
committerMark Dickinson <dickinsm@gmail.com>
Mon, 6 May 2013 13:39:31 +0000 (15:39 +0200)
Lib/site.py

index f13d4b4e4a616700086b34d731a93ba51803df20..96a4bef71efcc007e2bb9fa11166db98e77d87aa 100644 (file)
@@ -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: