def copy_to_temp ( object ) : temp_file = NamedTemporaryFile ( delete = False ) _copy_and_close ( object , temp_file ) return temp_file . name
python returning a tempfile without closing it
Copy file - like object to temp file and return path .
def copy_to_temp(object):
    """
    Copy file-like object to temp file and return
    path.
    """
    temp_file = NamedTemporaryFile(delete=False)
    _copy_and_close(object, temp_file)
    return temp_file.name