I keep getting this error message after trying to import csv file into Django models.
TICKERS has two columns: column[0] = name, column[1] = ticker
populate_symbol.py
def populate():
with open(TICKERS, 'rU') as csvfile:
file = csv.reader(csvfile, delimiter=',')
for row in file:
add_ticker(str(row[0]), str(row[1]))
def add_ticker(name, ticker):
c = Symbol.objects.get_or_create(name=name, ticker=ticker)
return c
Error message:
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8e in position 555: invalid start byte
Is there a way to flag csv reader to read all kind of data (utf-8 or unicode)?
P.S: Python 3.4.3, Django 1.7