python3.5 thrift cybin.ProtocolError:没有协议版本标头

时间:2017-04-28 08:20:35

标签: hbase thrift happybase

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/hskj/anaconda3/lib/python3.5/site-packages/happybase/connection.py", line 242, in tables
    names = self.client.getTableNames()
  File "/hskj/anaconda3/lib/python3.5/site-packages/thriftpy/thrift.py", line 198, in _req
    return self._recv(_api)
  File "/hskj/anaconda3/lib/python3.5/site-packages/thriftpy/thrift.py", line 210, in _recv
    fname, mtype, rseqid = self._iprot.read_message_begin()
  File "thriftpy/protocol/cybin/cybin.pyx", line 439, in cybin.TCyBinaryProtocol.read_message_begin (thriftpy/protocol/cybin/cybin.c:6470)
cybin.ProtocolError: No protocol version header

1 个答案:

答案 0 :(得分:0)

问题似乎与&#34;严格读/写&#34;的使用有关。标志。有一个非标准的&#34; cybin&#34;标准Thrift二进制协议的实现,错误在this particular code block

def read_message_begin(self):
    cdef int32_t size, version, seqid
    cdef TType ttype

    size = read_i32(self.trans)
    if size < 0:
        version = size & VERSION_MASK
        if version != VERSION_1:
            raise ProtocolError('invalid version %d' % version)

        name = c_read_val(self.trans, T_STRING)
        ttype = <TType>(size & TYPE_MASK)
    else:
        if self.strict_read:
            raise ProtocolError('No protocol version header')       // <<<<<<

        name = c_read_string(self.trans, size)
        ttype = <TType>(read_i08(self.trans))

    seqid = read_i32(self.trans)

    return name, ttype, seqid

如果没有尝试过,我猜测设置严格阅读&#34;在实例化CyBin协议时,应该标记为false(而不是true)。