python encoding issue only in cloud but not on-prem with python version on 2.7.5 on-prem and 2.7.18 on cloud

35 Views Asked by At

Below is the piece of code where it is writing from already encoded cp1252 files.

    with open(out_path, "a") as csv_file:
        writer = csv.writer(csv_file, dialect='excel', lineterminator='\n')
        writer.writerows(csv_values)

I am getting data as ? in place of -

I have tried to encode to cp1252 again, but getting below error

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 64: ordinal not in range(128)

Later I tried to decode and encode but then getting subsequent errors.

Strangely this issue is not seen on-prem and on cloud.

Does the python version impact in encoding ?

0

There are 0 best solutions below