uniqueness of temporary files generated by tempfile

Catherine Moroney Catherine.M.Moroney at jpl.nasa.gov
Sat Mar 7 00:06:26 CET 2009

Are the temporary filenames generated by the tempfile module
guaranteed to be unique?

I have a need to generate temporary files within an application,
and I will have many instances of this application running as a
sub-process (so I can submit them to a batch queue).  Is there
any danger of my different sub-processes accidentally generating
the same filename, or does tempfile check for the existence of
a similarly-named file before generating a filename?

What's the recommended way of generating temporary filenames
that are guaranteed to be unique even with multiple processes
running simultaneously?


More information about the Python-list mailing list