diff options
author | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:30:52 +0530 |
---|---|---|
committer | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:30:52 +0530 |
commit | 5c916d69d457101326803eb076a746060e3618cf (patch) | |
tree | d6fce3256eede1c1bf78fb6a1be75b9cc4b84cee /.config/python/pythonrc |
Moved from github
Diffstat (limited to '.config/python/pythonrc')
-rw-r--r-- | .config/python/pythonrc | 22 |
1 files changed, 22 insertions, 0 deletions
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) |