summaryrefslogtreecommitdiff
path: root/realtime
diff options
context:
space:
mode:
authorMichael Denkowski <mdenkows@sendai.lti.cs.cmu.edu>2013-09-22 22:49:46 -0400
committerMichael Denkowski <mdenkows@sendai.lti.cs.cmu.edu>2013-09-22 22:49:46 -0400
commit903339fdd7c294a72a8b2066550dbb5dd78f5384 (patch)
tree19737e43880b49e7dbf987815106d8889156ce04 /realtime
parent60013ff62cee092db5f85eb5ecb2ea6119f2da6d (diff)
Don't leak open files.
Diffstat (limited to 'realtime')
-rw-r--r--realtime/rt/rt.py3
1 files changed, 2 insertions, 1 deletions
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)))