This module provides an implementation of the FileAPI.File interface that can be used to wrap an arbitrary file-like object.
This module defines the following classes:
For example, the following function can be used to wrap a regular Python file object in a FileWrapper. Assume that the FileWrapper is created in an environment where the variable path specifies the file to be opened.
fw = FileWrapper(lambda mode, path=path: open(path, mode))
Instances of the FileWrapper class have the following methods. These methods raise FileAPI.FileIOError for errors, not the builtin IOError exception.