title: Read AVRO file using Python
body: <p>I have an AVRO file(created by JAVA) and seems like it is some kind of zipped file for hadoop/mapreduce, i want to 'unzip' (deserialize) it to a flat file. Per record per row. </p>
  
  <p>I learned that there is an <a href="http://avro.apache.org/docs/current/gettingstartedpython.html" rel="nofollow">AVRO package</a> for python, and I installed it correctly. And run the example to read the AVRO file. However, it came up with the errors below and I am wondering what is going on reading the simplest example? Can anyone help me interpret the errors bellow.</p>
  
  <pre><code>&gt;&gt;&gt; reader = DataFileReader(open("/tmp/Stock_20130812104524.avro", "r"), DatumReader())
  Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/.../python2.7/site-packages/avro/datafile.py", line 240, in __init__
      raise DataFileException('Unknown codec: %s.' % self.codec)
  avro.datafile.DataFileException: Unknown codec: snappy.
  </code></pre>
  
  <p>btw, if I do 'head' of file, and using VI to open up the first few lines of the AVRO file, I could see the schema definition together with some crappy weird characters - probably the zipped content. 
  The starting bit of the raw AVRO file looks like below:</p>
  
  <pre><code>bj^A^D^Tavro.codec^Lsnappy^Vavro.schemaØ${"type":"record","name":"Stoc...
  </code></pre>
  
  <p>I don't know if those schemas would be necessary to read the AVRO file, something like below:</p>
  
  <pre><code>schema = avro.schema.parse(open("schema").read())
  # include schema to do sth...
  reader = DataFileReader(open("Stock_20130812104524.avro", "r"), DatumReader())
  </code></pre>
  
  <p>Thanks in advance.</p>