(self, new_text, filename, old_text, encoding=None)
Writes a string to a file.

        It first shows a unified diff between the old text and the new text, and
        then rewrites the file; the latter is only done if the write option is
        set.
Writes a string to a file.
Writes a string to a file .
def write_file(self, new_text, filename, old_text, encoding=None):
        """Writes a string to a file.

        It first shows a unified diff between the old text and the new text, and
        then rewrites the file; the latter is only done if the write option is
        set.
        """
        try:
            fp = io.open(filename, "w", encoding=encoding, newline='')
        except OSError as err:
            self.log_error("Can't create %s: %s", filename, err)
            return

        with fp:
            try:
                fp.write(new_text)
            except OSError as err:
                self.log_error("Can't write %s: %s", filename, err)
        self.log_debug("Wrote changes to %s", filename)
        self.wrote = True
def write_file ( self , new_text , filename , old_text , encoding = None ) : try : fp = io . open ( filename , "w" , encoding = encoding , newline = '' ) except OSError as err : self . log_error ( "Can't create %s: %s" , filename , err ) return with fp : try : fp . write ( new_text ) except OSError as err : self . log_error ( "Can't write %s: %s" , filename , err ) self . log_debug ( "Wrote changes to %s" , filename ) self . wrote = True