Hi everyone,
I'm getting this error and have been looking online but don't really understand for my specific case and don't really know why this could be happening.
This is the error : 'UnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 184: invalid continuation byte
I'm trying to read a text file with the following lines
I don't really know what "position 184" means, none of the lines is even longer than 33 characters, and line 184 of the file is an empty line with only an EOL character.
I'm thinking it's the new timestamps I'm writing that have this problem, but have no clue which character may be. When I look for the character 0xda, I find it's a Ú; however, that character is being read normally in other instances and I'm not even overwriting it.
If some of you happen to have not seen an SRT file before, it looks like this:
9
00:00:15,377 --> 00:00:18,570
ESTAMOS HACIENDO
UN FASCINANTE EXPERIMENTO.
10
00:00:19,150 --> 00:00:20,280
AÚN LO ESCUCHO.
The lines where I do the replacement are the following:
PD: Please excuse me if I'm not being very clear about some things, just let me know and I'll clarify. I've been working for long hours and I'm kind of stuck.
I'm getting this error and have been looking online but don't really understand for my specific case and don't really know why this could be happening.
This is the error : 'UnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 184: invalid continuation byte
I'm trying to read a text file with the following lines
inFile = open(fileName, 'r', encoding="utf8") fileList = [] for line in inFile: fileList.append(line)What I'm reading is a simple SRT file. I created a program that takes an SRT file and fixes the timestamps to eliminate overlapping because the editor does this sometimes. This function does this correctly and doesn't have this problem when reading and, when I create the new, corrected file, I'm just copying the old file and replacing the lines with timestamps with the corrected ones. However, when I try to read the newly generated file to do a conversion to another format I have this problem. I've been working with functions that convert and manipulate this kind of files for a while, but I had never gotten this error, just a similar one that I can't remember now, that's why I used the encoding="utf8".
I don't really know what "position 184" means, none of the lines is even longer than 33 characters, and line 184 of the file is an empty line with only an EOL character.
I'm thinking it's the new timestamps I'm writing that have this problem, but have no clue which character may be. When I look for the character 0xda, I find it's a Ú; however, that character is being read normally in other instances and I'm not even overwriting it.
If some of you happen to have not seen an SRT file before, it looks like this:
9
00:00:15,377 --> 00:00:18,570
ESTAMOS HACIENDO
UN FASCINANTE EXPERIMENTO.
10
00:00:19,150 --> 00:00:20,280
AÚN LO ESCUCHO.
The lines where I do the replacement are the following:
inList[line] = hoursBegin + ':' + minutesBegin + ':' + secondsBegin + ',' + millisecondsBegin + ' --> ' +\ hoursEnd + ':' + minutesEnd + ':' + secondsEnd + ',' + millisecondsEnd + '\n'Thanks in advance.
PD: Please excuse me if I'm not being very clear about some things, just let me know and I'll clarify. I've been working for long hours and I'm kind of stuck.