-
tempfile.
tempdir
-
When set to a value other than
None
, this variable defines the default value for the dir argument to all the functions defined in this module.If
tempdir
is unset orNone
at any call to any of the above functions, Python searches a standard list of directories and sets tempdir to the first one which the calling user can create files in. The list is:- The directory named by the
TMPDIR
environment variable. - The directory named by the
TEMP
environment variable. - The directory named by the
TMP
environment variable. - A platform-specific location:
- On RiscOS, the directory named by the
Wimp$ScrapDir
environment variable. - On Windows, the directories
C:\TEMP
,C:\TMP
,\TEMP
, and\TMP
, in that order. - On all other platforms, the directories
/tmp
,/var/tmp
, and/usr/tmp
, in that order.
- On RiscOS, the directory named by the
- As a last resort, the current working directory.
- The directory named by the
-
tempfile.
gettempdir
( ) -
Return the directory currently selected to create temporary files in. If
tempdir
is notNone
, this simply returns its contents; otherwise, the search described above is performed, and the result returned.New in version 2.3.
-
tempfile.
template
-
Deprecated since version 2.0: Use
gettempprefix()
instead.When set to a value other than
None
, this variable defines the prefix of the final component of the filenames returned bymktemp()
. A string of six random letters and digits is appended to the prefix to make the filename unique. The default prefix istmp
.Older versions of this module used to require that
template
be set toNone
after a call toos.fork()
; this has not been necessary since version 1.5.2.