summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFichteFoll <fichtefoll2@googlemail.com>2018-02-24 20:01:09 +0100
committerFichteFoll <fichtefoll2@googlemail.com>2018-03-09 02:10:34 +0100
commite009af039cdbf8ba2070222b501584112e0b7f2e (patch)
treed0113d3e7b76eb83fe950039825978c09221685f
parent08b08d70f8b2f73d5f37c749774b9f16f0c82dbe (diff)
downloadranger-e009af039cdbf8ba2070222b501584112e0b7f2e.tar.gz
Close an unclosed file handle
-rw-r--r--ranger/core/actions.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 306a6166..0c09d41f 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -409,7 +409,8 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
         # ranger can act as a file chooser when running with --choosefile=...
         if mode == 0 and 'label' not in kw:
             if ranger.args.choosefile:
-                open(ranger.args.choosefile, 'w').write(self.fm.thisfile.path)
+                with open(ranger.args.choosefile, 'w') as fobj:
+                    fobj.write(self.fm.thisfile.path)
 
             if ranger.args.choosefiles:
                 paths = []