From 5c916d69d457101326803eb076a746060e3618cf Mon Sep 17 00:00:00 2001 From: Vikas Kushwaha Date: Thu, 21 Nov 2024 13:30:52 +0530 Subject: Moved from github --- .config/python/pythonrc | 22 ++++++++++++++++++++++ 1 file changed, 22 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..9ab457e --- /dev/null +++ b/.config/python/pythonrc @@ -0,0 +1,22 @@ +import os +import atexit +import readline + +state_home = os.environ.get("XDG_STATE_HOME") +if state_home is None: + state_home = os.path.join(os.path.expanduser('~'), ".local", "state") + +history = os.path.join(state_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