Close temp file before deleting it.

This commit is contained in:
Craig Moyer 2014-12-09 20:54:58 -05:00
parent 0d1b381bd1
commit 01a7f660f3

View file

@ -125,9 +125,10 @@ def get_text_from_editor(config, template=""):
with codecs.open(tmpfile, 'w', "utf-8") as f:
if template:
f.write(template)
subprocess.call(config['editor'].split() + [tmpfile])
subprocess.call(config['editor'].split() + [tmpfile])
with codecs.open(tmpfile, "r", "utf-8") as f:
raw = f.read()
os.close(_);
os.remove(tmpfile)
if not raw:
prompt('[Nothing saved to file]')