tempfile.mkstemp and os.fdopen
Nick Craig-Wood
nick at craig-wood.com
Tue Aug 28 16:30:06 EDT 2007
billiejoex <gnewsg at gmail.com> wrote:
> I'm trying to generate a brand new file with a unique name by using
> tempfile.mkstemp().
>
> Moreover, I'd like to know if I'm doing fine. Does this approach avoid
> race conditions
This is a reasonably secure way of doing things. It can't race under
unix at least (dunno about windows) unless your dir is on NFS.
If you want more security then make sure dir isn't publically
writeable.
--
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list
mailing list