Commit 67c6506b authored by Yohei Kikuta's avatar Yohei Kikuta Committed by Matthijs Douze

Replace os.tempnam with tempfile for python3 (#537)

os.tempnam is eliminated in python3.
Used tempfile.NamedTemporaryFile().name instead.
This is also valid for python2.7.
parent 2dc30e14
......@@ -12,6 +12,7 @@ import numpy as np
import unittest
import faiss
import os
import tempfile
def make_binary_dataset(d, nb, nt, nq):
assert d % 8 == 0
......@@ -37,7 +38,7 @@ class TestBinaryFlat(unittest.TestCase):
index.add(self.xb)
D, I = index.search(self.xq, 3)
tmpnam = os.tempnam()
tmpnam = tempfile.NamedTemporaryFile().name
try:
faiss.write_index_binary(index, tmpnam)
......@@ -74,7 +75,7 @@ class TestBinaryIVF(unittest.TestCase):
index.add(self.xb)
D, I = index.search(self.xq, 3)
tmpnam = os.tempnam()
tmpnam = tempfile.NamedTemporaryFile().name
try:
faiss.write_index_binary(index, tmpnam)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment