[issue26362] Approved API for creating a temporary file path
Serhiy Storchaka
report at bugs.python.org
Mon May 1 15:00:55 EDT 2017
Serhiy Storchaka added the comment:
> temp_name = tempfile.mktemp(dir=".")
> os.link("a", temp_name)
There is a race condition between generating file name and using it. tempfile.mktemp() is not much more useful that just a function that generates some names which unlikely matches the names of existing files the directory. In any case you should catch an error and repeat an attempt with different name. How much attempts to do and what additional checks to do is an application specific.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26362>
_______________________________________
More information about the Python-bugs-list
mailing list