about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-07-17 21:28:47 +0200
committertoonn <toonn@toonn.io>2021-07-20 23:17:45 +0200
commit8f6434f98a43b27468ced2df7ca3469a03204054 (patch)
tree4c2c5dcf1a0d815da5b5583e24db9fbe7b448c0b
parent9f6550d471351599ffef67d55c61d82e2ae76542 (diff)
downloadranger-8f6434f98a43b27468ced2df7ca3469a03204054.tar.gz
gui.colorscheme: Use with for file creation
-rw-r--r--ranger/gui/colorscheme.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index 01862957..0e68c5ff 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -108,7 +108,9 @@ def _colorscheme_name_to_class(signal):  # pylint: disable=too-many-branches
         if os.path.exists(signal.fm.confpath('colorschemes')):
             initpy = signal.fm.confpath('colorschemes', '__init__.py')
             if not os.path.exists(initpy):
-                open(initpy, 'a').close()
+                with open(initpy, "a"):
+                    # Just create the file
+                    pass
 
     if usecustom and \
             exists(signal.fm.confpath('colorschemes', scheme_name)):