【问题标题】:python3.5 thrift cybin.ProtocolError: No protocol version headerpython3.5 thrift cybin.ProtocolError: 没有协议版本头
【发布时间】:2017-09-26 06:57:45
【问题描述】:
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

【问题讨论】:

  • >>> import happybase >>> conn = happybase.Connection('192.168.110.2',9000) >>> conn.tables() ... cybin.ProtocolError: No protocol version header
  • 请发帖MVCE

标签: hbase thrift happybase


【解决方案1】:

问题似乎与“严格读/写”标志的使用有关。有一个标准T​​hrift二进制协议的非标准“cybin”实现,错误在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

没有尝试过,我猜想在实例化 CyBin 协议时将“严格读取”标志设置为 false(而不是 true)应该可以解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    • 2020-06-15
    • 2017-03-14
    • 1970-01-01
    • 2017-11-03
    • 2017-06-25
    • 2010-12-14
    相关资源
    最近更新 更多