Skip to content Skip to sidebar Skip to footer

Unicodedecodeerror: 'ascii' Codec Can't Decode Byte In 0xc3 In Position 304: Ordinal Not In Range(128)

I just left the PC at work (using Python 2.7) and had a script that I was just finishing up (reproduced below). It ran fine at work, I just wanted to add one or two things. But I c

Solution 1:

It looks like Fund_Aliases.csv is not an ascii file.

According to the Python3 docs:

Since open() is used to open a CSV file for reading, the file will by default be decoded into unicode using the system default encoding (see locale.getpreferredencoding()). To decode a file using a different encoding, use the encoding argument of open:

withopen('some.csv', newline='', encoding='utf-8') as f:
    reader = csv.reader(f)

So try specifying the encoding parameter.

Post a Comment for "Unicodedecodeerror: 'ascii' Codec Can't Decode Byte In 0xc3 In Position 304: Ordinal Not In Range(128)"