Skip to content

Commit b97bb36

Browse files
authored
resolve tempfile interfaces (#308)
1 parent 4e24a6c commit b97bb36

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tutel/system.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ def perform(fn, num_runs=100):
103103
def from_url(link, path=None):
104104
import requests
105105
import tempfile
106-
file_name = path or tempfile.mktemp()
106+
if path is not None:
107+
file_name = path
108+
else:
109+
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".download")
110+
file_name = tmp.name
111+
tmp.close()
107112

108113
if not os.path.exists(file_name) and link is not None:
109114
dirname = os.path.dirname(file_name) or '.'

0 commit comments

Comments
 (0)