redirect_fd
(class from pyomo.common.tee
)
- class pyomo.common.tee.redirect_fd(fd=1, output=None, synchronize=True)[source]
Bases:
object
Redirect a file descriptor to a new file or file descriptor.
This context manager will redirect the specified file descriptor to a specified new output target (either file name or file descriptor). For the special case of file descriptors 1 (stdout) and 2 (stderr), we will also make sure that the Python sys.stdout or sys.stderr remain usable: in the case of synchronize=True, the sys.stdout / sys.stderr file handles point to the new file descriptor. When synchronize=False, we preserve the behavior of the Python file object (retargeting it to the original file descriptor if necessary).
- Parameters:
Methods
__init__
([fd, output, synchronize])Member Documentation