fsl.utils.tempdir
This module contains utilities for working with temporary files and directories. It currently only contains one function:
Returns a context manager which creates and returns a temporary directory, and then deletes it on exit. |
- fsl.utils.tempdir.tempdir(root=None, changeto=True, override=None, prefix=None)[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.prefix – Create the temporary directory with a name starting with this prefix.