John Kern created AVRO-1629:
-------------------------------
Summary: Python getting started document appears to need updating
Key: AVRO-1629
URL: https://issues.apache.org/jira/browse/AVRO-1629
Project: Avro
Issue Type: Bug
Components: python
Affects Versions: 1.7.7
Reporter: John Kern
Priority: Minor
Hello,
I was just working through the Avro getting started document and noticed it is
a bit out of date. Consider the following diffs.
Sincerely,
John
(py3)jkern@ubuntu:~/scratch/avro-trunk/doc/examples$ svn diff example.py
Index: example.py
===================================================================
--- example.py (revision 1651542)
+++ example.py (working copy)
@@ -2,14 +2,14 @@
from avro.datafile import DataFileReader, DataFileWriter
from avro.io import DatumReader, DatumWriter
-schema = avro.schema.parse(open("user.avsc").read())
+schema = avro.schema.Parse(open("user.avsc").read())
-writer = DataFileWriter(open("/tmp/users.avro", "w"), DatumWriter(), schema)
+writer = DataFileWriter(open("/tmp/users.avro", "wb"), DatumWriter(), schema)
writer.append({"name": "Alyssa", "favorite_number": 256, "WTF": 2})
writer.append({"name": "Ben", "favorite_number": 7, "favorite_color": "red"})
writer.close()
-reader = DataFileReader(open("/tmp/users.avro", "r"), DatumReader())
+reader = DataFileReader(open("/tmp/users.avro", "rb"), DatumReader())
for user in reader:
- print user
+ print (user)
reader.close()
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)