I am new to python and I was trying to write simple code to convert a text file to avro. I get this error that the module was not found. I could clearly see in the schema.py file that the parser exists. I would appreciate it if someone would help me understand what I might be doing wrong.
import avro.schema, csv, codecs from avro.datafile import DataFileReader, DataFileWriter from avro.io import DatumReader, DatumWriter def unicode_csv_reader(unicode_csv_data, dialect=csv.excel, **kwargs): # csv.py doesn't do Unicode; encode temporarily as UTF-8: csv_reader = csv.reader(utf_8_encoder(unicode_csv_data), dialect=dialect, **kwargs) for row in csv_reader: # decode UTF-8 back to Unicode, cell by cell: yield [unicode(cell, 'utf-8') for cell in row] def utf_8_encoder(unicode_csv_data): for line in unicode_csv_data: yield line.encode('utf-8') schema = avro.schema.parse(open('C:/test/test.avsc', "rb").read())
I am using Python 3.5.2, avro-python3-1.8.1 on Windows 10.
source share