fsl.utils.tempdir
This module contains utilities for working with temporary files and directories. It currently contains the following functions:
Returns a context manager which creates and returns a temporary directory, and then deletes it on exit. |
|
Wrapper around |
- fsl.utils.tempdir.tempdir(root=None, changeto=True, override=None, prefix=None, delete=True)[source]
Returns a context manager which creates and returns a temporary directory, and then deletes it on exit.
- Parameters:
root – If provided, specifies a directroy in which to create the new temporary directory. Otherwise the system default is used (see the
tempfile.mkdtemp
documentation).changeto – If
True
(the default), current working directory is set to the new temporary directory before yielding, and restored afterwards.override – Don’t create a temporary directory, but use this one instead. This allows
tempdir
to be used as a context manager when a temporary directory already exists. Impliesdelete=False
.prefix – Create the temporary directory with a name starting with this prefix.
delete – If
True
(the default), the directory is deleted on exit. Otherwise the caller is responsible for deleting the directory.