(self, *,
                    encoding=None, errors=None, newline=Ellipsis,
                    line_buffering=None, write_through=None)
Reconfigure the text stream with new parameters.

        This also flushes the stream.
Reconfigure the text stream with new parameters.
Reconfigure the text stream with new parameters .
def reconfigure(self, *,
                    encoding=None, errors=None, newline=Ellipsis,
                    line_buffering=None, write_through=None):
        """Reconfigure the text stream with new parameters.

        This also flushes the stream.
        """
        if (self._decoder is not None
                and (encoding is not None or errors is not None
                     or newline is not Ellipsis)):
            raise UnsupportedOperation(
                "It is not possible to set the encoding or newline of stream "
                "after the first read")

        if errors is None:
            if encoding is None:
                errors = self._errors
            else:
                errors = 'strict'
        elif not isinstance(errors, str):
            raise TypeError("invalid errors: %r" % errors)

        if encoding is None:
            encoding = self._encoding
        else:
            if not isinstance(encoding, str):
                raise TypeError("invalid encoding: %r" % encoding)

        if newline is Ellipsis:
            newline = self._readnl
        self._check_newline(newline)

        if line_buffering is None:
            line_buffering = self.line_buffering
        if write_through is None:
            write_through = self.write_through

        self.flush()
        self._configure(encoding, errors, newline,
                        line_buffering, write_through)
def reconfigure ( self , * , encoding = None , errors = None , newline = Ellipsis , line_buffering = None , write_through = None ) : if ( self . _decoder is not None and ( encoding is not None or errors is not None or newline is not Ellipsis ) ) : raise UnsupportedOperation ( "It is not possible to set the encoding or newline of stream " "after the first read" ) if errors is None : if encoding is None : errors = self . _errors else : errors = 'strict' elif not isinstance ( errors , str ) : raise TypeError ( "invalid errors: %r" % errors ) if encoding is None : encoding = self . _encoding else : if not isinstance ( encoding , str ) : raise TypeError ( "invalid encoding: %r" % encoding ) if newline is Ellipsis : newline = self . _readnl self . _check_newline ( newline ) if line_buffering is None : line_buffering = self . line_buffering if write_through is None : write_through = self . write_through self . flush ( ) self . _configure ( encoding , errors , newline , line_buffering , write_through )