This module generates temporary file names. It is not Unix specific,
but it may require some help on non-Unix systems.
The module defines the following user-callable functions:
The mode parameter defaults to The module uses two global variables that tell it how to construct a
temporary name. The caller may assign values to them; by default they
are initialized at the first call to mktemp().
Older versions of this module used to require that mktemp([suffix])
TemporaryFile([mode[,
bufsize[, suffix]]])
'w+b' so that the file
created can be read and written without being closed. Binary mode is
used so that it behaves consistently on all platforms without regard
for the data that is stored. bufsize defaults to -1,
meaning that the operating system default is used. suffix is
passed to mktemp().
tempdir
None, this variable defines the
directory in which filenames returned by mktemp() reside.
The default is taken from the environment variable $TMPDIR; if
this is not set, either /usr/tmp is used (on Unix), or the
current working directory (all other systems). No check is made to
see whether its value is valid.
gettempprefix()
template variable directly.
New in version 1.5.2template
None, this variable defines the
prefix of the final component of the filenames returned by
mktemp(). A string of decimal digits is added to generate
unique filenames. The default is either @pid. where
pid is the current process ID (on Unix),
pid- on Windows NT, Python-Tmp- on
MacOS, or tmp (all other systems).
template be
set to None after a call to os.fork(); this has not
been necessary since version 1.5.2.