diff --git a/jrnl/util.py b/jrnl/util.py index a14e2915..7a049ac0 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -128,11 +128,9 @@ def load_and_fix_json(json_path): def get_text_from_editor(config, template=""): tmpfile = os.path.join(tempfile.gettempdir(), "jrnl") - if template: - with codecs.open(tmpfile, 'w', "utf-8") as f: + with codecs.open(tmpfile, 'w', "utf-8") as f: + if template: f.write(template) - with open(tmpfile, 'w'): - pass subprocess.call(config['editor'].split() + [tmpfile]) with codecs.open(tmpfile, "r", "utf-8") as f: raw = f.read()