avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lexicalunit <...@lexicalunit.com>
Subject Can't even import AVRO library without fatal errors
Date Tue, 09 Feb 2016 23:55:18 GMT
I was attempting to import avro and encountered this error.

$ python
Python 3.5.1 |Continuum Analytics, Inc.| (default, Dec  7 2015, 11:24:55)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from avro import io
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/me/anaconda/envs/py35/lib/python3.5/site-packages/avro/io.py", line 200
    bits = (((ord(self.read(1)) & 0xffL)) |
                                      ^
SyntaxError: invalid syntax

Going back to pip I noticed there’s a “avro-python3” package so I uninstalled the “avro”
package and installed that since I am using Python 3.5.1. Now I can import io, but I have
a different error:

$ python
Python 3.5.1 |Continuum Analytics, Inc.| (default, Dec  7 2015, 11:24:55)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from avro.io import validate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name ‘validate'

I’d like to use this library https://github.com/linkedin/python-avro-json-serializer <https://github.com/linkedin/python-avro-json-serializer>
which imports validate. Unless there’s some other way to get the same functionality using
avro directly? Essentially, I have a Python dict representing AVRO data and a Python dict
representing the AVRO Schema I want to use. I just need to generate JSON with type annotations
and all that jazz that AVRO requires.

This should be easy, no? I feel like I’m missing something here.
Mime
View raw message