temp_file
- Temporary files that support the context protocol¶
Temporary files and directories.
Requires at least Python 2.6
-
class
TempDir
(*args, **kwargs)[source]¶ A temporary directory that implements the context manager protocol.
The directory is removed when the context is exited from. Uses
tempfile.mkdtemp()
to create the actual directory.-
name
¶ Return the directory name.
-
-
class
TempFile
(*args, **kwargs)[source]¶ A temporary file that implements the context manager protocol.
Wrap a
tempfile.NamedTemporaryFile()
generated file-like object, to ensure it is not deleted on close, but rather when the underlying context is closed.-
name
¶ Return the actual file name.
-