tempfile
Note: the modules does not create temporary files, nor does it automatically remove them when the current process exits or dies.
The module defines a single user-callable function:
mktemp()
.
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.
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), or ``tmp
'' (all
other systems).
mktemp()
, then calls
fork()
and both parent and child continue to use
mktemp()
, the processes will generate conflicting temporary
names. To resolve this, the child process should assign None
to template
, to force recomputing the default on the next call
to mktemp()
.