summaryrefslogtreecommitdiff
path: root/Lib/site.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 4595244e2f..ffd132b389 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