Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d35133

Browse files
committed
Issue #5845: avoid an exception at startup on OS X if no .editrc file exists.
1 parent 60bb107 commit 9d35133

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

Lib/site.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,15 @@ def register_readline():
478478
readline.parse_and_bind('bind ^I rl_complete')
479479
else:
480480
readline.parse_and_bind('tab: complete')
481-
readline.read_init_file()
481+
482+
try:
483+
readline.read_init_file()
484+
except OSError:
485+
# An OSError here could have many causes, but the most likely one
486+
# is that there's no .inputrc file (or .editrc file in the case of
487+
# Mac OS X + libedit) in the expected location. In that case, we
488+
# want to ignore the exception.
489+
pass
482490

483491
history = os.path.join(os.path.expanduser('~'), '.python_history')
484492
try:

0 commit comments

Comments
 (0)