Thanks to the tips. I thought like you, my dificulty it's the python. So, i'm create a program and works. Thanks awnser me!
Python 3 : Works!
BUT, i need to work on Python 2
def dger_ano(FILE_DATE, ORIGEM, DESTINO): cache = None string = "ANO INICIO DO ESTUDO 2016" #str(int(FILE_DATE) - 1) with open(ORIGEM , "r") as f: cache = f.read() new_file = re.sub(string, "ANO INICIO DO ESTUDO {}".format(FILE_DATE), cache) if new_file: with open(DESTINO + "/temporario.txt", "w") as f: f.write(new_file) os.remove(DESTINO + "/DGER.dat") os.rename(DESTINO + '/temporario.txt',DESTINO + '/DGER.dat')In Python 2 : has the accent on the file appears this error message, "UnicodeDecodeError: 'ascii' codec can't decode byte 0xba in position 1355: ordinal not in range(128) "
Python 3 : Works!
BUT, i need to work on Python 2