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 <rep...@bugs.python.org>
<http://bugs.python.org/issue26362>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to