- I have a function who reads
MemoryObject
of file. It is reading most of the files but for one file it is raisingUnicodeDecodeError
.
here is my code
def read(file):
"""
:param file: File Memory Object (submitted from POST)
:return: File Iterable object
"""
file = StringIO(file.read().decode())
return csv.DictReader(file, delimiter=',')
Complete error is as follows : UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte
- In other question where user have asked questions of similar errors. they are using
open()
to streamline the file but I already have streamline MemoryObject so can't useopen()