Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> Python Errors


I installed avro for python.

Like Referred :
https://avro.apache.org/docs/current/gettingstartedpython.html
1. Build as per the instructions. Here is the output.

************** Installation Output*******************
/usr/lib64/python2.3/distutils/dist.py:227: UserWarning: Unknown
distribution option: 'extras_require'
  warnings.warn(msg)
/usr/lib64/python2.3/distutils/dist.py:227: UserWarning: Unknown
distribution option: 'install_requires'
  warnings.warn(msg)
running install
running build
running build_py
running build_scripts
running install_lib
byte-compiling /usr/lib/python2.3/site-packages/avro/io.py to io.pyc
  File "/usr/lib/python2.3/site-packages/avro/io.py", line 371
    @staticmethod
    ^
SyntaxError: invalid syntax
byte-compiling /usr/lib/python2.3/site-packages/avro/schema.py to schema.pyc
  File "/usr/lib/python2.3/site-packages/avro/schema.py", line 589
    @staticmethod
    ^
SyntaxError: invalid syntax
byte-compiling /usr/lib/python2.3/site-packages/avro/datafile.py to
datafile.pyc
  File "/usr/lib/python2.3/site-packages/avro/datafile.py", line 71
    @staticmethod
    ^
SyntaxError: invalid syntax
running install_scripts
changing mode of /usr/bin/avro to 755
************** Installation Output*******************

2.I checked import avro on python prompt as follows
Python 2.3.4 (#1, Jan 11 2011, 14:40:50)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import avro
>>>

3. I created the file user.avsc containing schema given at about link

4. Copied the code from above link in BasicAvro.py (I added #!
/usr/bin/python)

5.Both BasicAvrio..py and user.avsc are in the same directory. If I run

pyhon BasicAvro.py

gives error

Traceback (most recent call last):
  File "BasicAvro.py", line 2, in ?
    import avro.schema
  File "/usr/lib/python2.3/site-packages/avro/schema.py", line 589
    @staticmethod
    ^
SyntaxError: invalid syntax

6. Tried executing the script under scripts directory called avro.

gives following error

  File "avro", line 75
    return dict((k, obj[k]) for k in (set(obj) & fields))
                              ^
SyntaxError: invalid syntax

7. What is going wrong ?