Error that stumped me, on python 3.6.8, while reading data from .log.xz file:
'ascii' codec can't decode byte 0xc3 in position 662565: ordinal not in range(128)
Traceback (most recent call last):
...
data = file.read()
File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
Higher in the code where the file object is created:(Tried both)
file = lzma.open(path, "rt")
and also tried
file = lzma.open(path, "rt", encoding="UTF-8")
The files in question are text logs , 50MB each, compressed in XZ, (.log.xz)
Folder of these are zipped on Windows machine and uploaded to GIT.
On Build server, the python application is started as a part of a pipeline in corporate gitlab devops.
Python unzips the files and then processes file by file on the build server and reaches the error above.
Testing the same code on windows locally and deployed on a linux servers I see no issues.
Issue only happens on the build server agent, that I don't have access to.
Default encoding:
sys.getdefaultencoding() : utf-8
Tried many things, Any ideas would be very helpful. Thanks