diff options
author | Anthony Sottile <asottile@umich.edu> | 2018-08-06 08:28:19 (GMT) |
---|---|---|
committer | INADA Naoki <methane@users.noreply.github.com> | 2018-08-06 08:28:19 (GMT) |
commit | b2499669ef2e6dc9a2cdb49b4dc498e078167e26 (patch) | |
tree | 28ffb82682d44f3eda4ff6f54211608a900139a4 /Lib/site.py | |
parent | 336c945858055059a65134d4c501a85037d70d99 (diff) | |
download | cpython-b2499669ef2e6dc9a2cdb49b4dc498e078167e26.zip cpython-b2499669ef2e6dc9a2cdb49b4dc498e078167e26.tar.gz cpython-b2499669ef2e6dc9a2cdb49b4dc498e078167e26.tar.bz2 |
bpo-19891: Ignore error while writing history file (GH-8483)
Diffstat (limited to 'Lib/site.py')
-rw-r--r-- | Lib/site.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py index 4595244..ffd132b 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -439,7 +439,16 @@ def enablerlcompleter(): readline.read_history_file(history) except OSError: pass - atexit.register(readline.write_history_file, history) + + def write_history(): + try: + readline.write_history_file(history) + except (FileNotFoundError, PermissionError): + # home directory does not exist or is not writable + # https://bugs.python.org/issue19891 + pass + + atexit.register(write_history) sys.__interactivehook__ = register_readline |