From 4527866e2d3da85aed73dec39d7239a9b9b5d909 Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Wed, 17 Dec 2014 09:50:39 -0700 Subject: [PATCH] Name file handle if we're going to us it --- jrnl/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jrnl/util.py b/jrnl/util.py index 49dcf726..c7bda145 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -126,14 +126,14 @@ def load_and_fix_json(json_path): sys.exit(1) def get_text_from_editor(config, template=""): - _, tmpfile = tempfile.mkstemp(prefix="jrnl", text=True, suffix=".txt") + filehandle, tmpfile = tempfile.mkstemp(prefix="jrnl", text=True, suffix=".txt") with codecs.open(tmpfile, 'w', "utf-8") as f: if template: f.write(template) subprocess.call(config['editor'].split() + [tmpfile]) with codecs.open(tmpfile, "r", "utf-8") as f: raw = f.read() - os.close(_); + os.close(filehandle); os.remove(tmpfile) if not raw: prompt('[Nothing saved to file]')