From 68b862a8aeab15e662bbba10084a541870b15648 Mon Sep 17 00:00:00 2001 From: Adam <56338480+adastx@users.noreply.github.com> Date: Tue, 5 Jul 2022 21:22:16 +0100 Subject: xdg: python_history --- .config/python/pythonrc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .config/python/pythonrc (limited to '.config/python/pythonrc') diff --git a/.config/python/pythonrc b/.config/python/pythonrc new file mode 100644 index 0000000..f3f86a5 --- /dev/null +++ b/.config/python/pythonrc @@ -0,0 +1,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) -- cgit v1.2.3-70-g09d2