Sample Header Ad - 728x90

Change location of `~/.python_history`

17 votes
6 answers
7143 views
I want to keep the functionality, but change the location of ~/.python_history to $XDG_DATA_HOME/python/python_history. [This](https://unix.stackexchange.com/a/297834/282466) gave me the following idea: I could create $XDG_CONFIG_HOME/python/pythonrc and point $PYTHONSTARTUP to it. In there I want to replace the functions readline.read_history_file, readline.write_history_file and readline.append_history_file. Is there way to replace these functions with themselves, containing a custom filename argument? If not, do you have another idea how to approach this?
Asked by maddingl (686 rep)
Jan 23, 2021, 11:06 PM
Last activity: Jun 1, 2025, 10:09 PM