summaryrefslogtreecommitdiff
path: root/.config/python/pythonrc
blob: f3f86a5ebe25875c8b8267e31b1444f95d203e7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os
import atexit
import readline

history = os.path.join(os.environ['XDG_CACHE_HOME'], 'python_history')
try:
    readline.read_history_file(history)
except OSError:
    pass

def write_history():
    try:
        readline.write_history_file(history)
    except OSError:
        pass

atexit.register(write_history)