cf.tempdir

cf.tempdir(*arg)[source]

The directory for internally generated temporary files.

When setting the directory, it is created if the specified path does not exist.

Parameters
arg: str, optional

The new directory for temporary files. Tilde expansion (an initial component of ~ or ~user is replaced by that user’s home directory) and environment variable expansion (substrings of the form $name or ${name} are replaced by the value of environment variable name) are applied to the new directory name.

The default is to not change the directory.

Returns
str

The directory prior to the change, or the current directory if no new value was specified.

Examples

>>> cf.tempdir()
'/tmp'
>>> old = cf.tempdir('/home/me/tmp')
>>> cf.tempdir(old)
'/home/me/tmp'
>>> cf.tempdir()
'/tmp'