Search code examples
pythonhbasethrifthappybase

Thrift error while generating python client file


I'm new to Hbase and I would like to comunicate with it throught a python API which works with Thrift. I've followed this tutorial in order to install it properly on my machine, everything seemed to worked fine then I generated a .thrift file with the following command:

wget http://svn.apache.org/viewvc/hbase/trunk/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift\?view\=markup 
-O hbase.thrift

Then I tried to generate my client like it's showed here but i get the following error message:

[ERROR:/home/tests/hbase/hbase.thrift:12] (last token was '<')
syntax error
[FAILURE:/home/tests/hbase/hbase.thrift:12] Parser error during include pass.

I tried to lookup on internet what was the cause of this error and found this paper, I tried to lookup in thriftl.ll to see if I could correct the error but I found that the correction was already present in the file.

What can I do more in order to make this work ?

Thank you !

EDIT: I'm using thrift 0.9.0


Solution

  • Using a fairly recent Thrift version and more importantly the proper URL I was able to generate Python sources without errors.

    Please check if your download is actually a Thrift file or if it is a HTML source. The error message sounds very much like that, since HTML pages typically start with an <, and the right Thrift file contains the first < at line 110 (within list<Mutation>), not around line 12.

    PS: Why are you using such an old version? 0.9.1 was released a year ago and 0.9.2 is actually in the process of being released.

    PPS: Actually, the referenced ticket THRIFT-1274 seems not have much to do with it. But maybe I'm overlooking something.