def switch_stdin(self):
        isatty = False
        try:
            fileno = sys.stdin.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.stdin.flush()
            self.__old_stdin = sys.stdin
            # if this fails, we'll raise an IOError
            stdin = open('/dev/tty', 'r')
            sys.stdin = stdin
        else:
            self.__old_stdin = None

    # override for cases where we want to search a different
    # path for the file
dataset/ETHPy150Open sassoftware/conary/conary/lib/epdb_embedded/__init__.py/Epdb.switch_stdin