def switch_stdout(self):
        isatty = False
        try:
            fileno = sys.stdout.fileno()
            isatty = isinstance(sys.stdout, file) and os.isatty(fileno)
        except __HOLE__:
            pass
            # sys.stdout is not a regular file,
            # go through some hoops
            # (this is less desirable because it doesn't redirect
            # low-level writes to 1)

        if not isatty:
            sys.stdout.flush()
            self.__old_stdout = sys.stdout
            # if this fails, we'll raise an IOError
            stdout = open('/dev/tty', 'w')
            sys.stdout = stdout
        else:
            self.__old_stdout = None
dataset/ETHPy150Open sassoftware/conary/conary/lib/epdb_embedded/__init__.py/Epdb.switch_stdout