about summary refs log tree commit diff stats
path: root/hm
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-09 21:02:51 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-09 21:02:51 +0200
commit746ae8c56e9a4ca292d4161095a62d8dd0620241 (patch)
treea230e2ea2149c5fc2f524d0ca0d2d46d5ebdbc8f /hm
parentfix(sys/pkgs/comments): Don't require `sponsorblock_chapters` (diff)
downloadnixos-config-746ae8c56e9a4ca292d4161095a62d8dd0620241.tar.gz
nixos-config-746ae8c56e9a4ca292d4161095a62d8dd0620241.zip
fix(hm/conf/python): Create history file, if it does not exist
Diffstat (limited to '')
-rw-r--r--hm/soispha/conf/python/pythonrc.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/hm/soispha/conf/python/pythonrc.py b/hm/soispha/conf/python/pythonrc.py
index 5c2ed3b9..940ebaec 100644
--- a/hm/soispha/conf/python/pythonrc.py
+++ b/hm/soispha/conf/python/pythonrc.py
@@ -1,12 +1,10 @@
 #!/usr/bin/env python3
 
-
 def is_vanilla() -> bool:
     import sys
 
     return not hasattr(__builtins__, "__IPYTHON__") and "bpython" not in sys.argv[0]
 
-
 def setup_history():
     import os
     import atexit
@@ -20,10 +18,14 @@ def setup_history():
 
     history: Path = state_home / "python" / "history"
 
+    if not os.path.exists(history):
+        open(history, 'w')
+
     readline.read_history_file(str(history))
     atexit.register(readline.write_history_file, str(history))
 
 
 if is_vanilla():
     setup_history()
+
 # vim: ft=python