dotfiles/dot_config/python/startup.py

17 lines
394 B
Python
Raw Normal View History

2021-02-15 20:53:16 -05:00
#! /bin/python
import atexit
import os
import readline
datadir = os.environ["XDG_DATA_HOME"]
histfile = os.path.join(datadir, "python", "history.log")
try:
readline.read_history_file(histfile)
# default history len is -1 (infinite), which may grow unruly
readline.set_history_length(1000)
except FileNotFoundError:
pass
atexit.register(readline.write_history_file, histfile)