Unable to read avro file in python

Asked by At

I am reading an avro file and it is throwing error --

assert (nbytes >= 0), nbytes
AssertionError: -10989560

on the file read line --

reader = DataFileReader(open(input_avro_file, "rb"), DatumReader())

When trying to create a bigquery table using the same avro ,I am getting this error --

Cannot have bytes of negative length:-10989560

I am unable to solve it

Please help me with this Thanks in advance

If I open the file in r mode and not binary then another error shows up --

return input_bytes.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'

which is possibly because the file is now read as string

0 Answers