From 903339fdd7c294a72a8b2066550dbb5dd78f5384 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Sun, 22 Sep 2013 22:49:46 -0400 Subject: Don't leak open files. --- realtime/rt/rt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'realtime/rt') diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index b1cf19ef..033ed790 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -101,7 +101,8 @@ class RealtimeDecoder: logging.info('Grammar cache hit') return grammar_file # Extract and cache - grammar_file = tempfile.mkstemp(dir=self.tmp, prefix='grammar.')[1] + (fid, grammar_file) = tempfile.mkstemp(dir=self.tmp, prefix='grammar.') + os.close(fid) with open(grammar_file, 'w') as output: for rule in self.extractor.grammar(sentence): output.write('{}\n'.format(str(rule))) -- cgit v1.2.3