summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)))