我的 python 版本是 3.7,运行后pip3 install happybase,我启动命令hbase thrift start并尝试编写一个简短的 .py 文件,如下所示:
import happybase
connection = happybase.Connection('master')
table = connection.table('jmlr') #'jmlr' is a table in hbase
for i in table.scan():
print(i)
table.put('001', {'title':'dasds'}) #error here
connection.close()
即将运行table.put()时,报了这样一个错误:
thriftpy2.transport.base.TTransportException: TTransportException(type=4, message='TSocket read 0 bytes')
并且同时thrift报错:
ERROR [thrift-worker-1] thrift.TBoundedThreadPoolServer: Error occurred during processing of message. java.lang.IllegalArgumentException: Invalid famAndQf provided.
但是刚才我再次运行了这个 python 文件,它给了我一个不同的错误thrift:
thrift.TBoundedThreadPoolServer: Thrift error occurred during processing of message.
org.apache.thrift.protocol.TProtocolException: Bad version in readMessageBegin
我曾尝试添加类似的参数protocol='compact', transport='framed',但这不起作用,即使table.scan()失败了。里面的一切都hbase shell很好,所以我不知道出了什么问题,我快崩溃了。