Closed naah69 closed 5 years ago
The problem could be that the server is expecting the compact protocol, but the client defaults to binary. Try calling setProtocol(COMPACT) on DriftNettyClientConfig.
If that doesn’t work, please show the code for a sample Python server that reproduces the issue.
i try Protocol.COMPACT ,Protocol.BINARY and Protocol.FB_COMPACT. python always show the following error:
2018-11-03 11:39:22 ERROR thriftpy.server - No protocol version header
Traceback (most recent call last):
File "/root/anaconda3/envs/rasa/lib/python3.6/site-packages/thriftpy/server.py", line 95, in handle
self.processor.process(iprot, oprot)
File "/root/anaconda3/envs/rasa/lib/python3.6/site-packages/thriftpy/thrift.py", line 294, in process
api, seqid, result, call = self.process_in(iprot)
File "/root/anaconda3/envs/rasa/lib/python3.6/site-packages/thriftpy/thrift.py", line 250, in process_in
api, type, seqid = iprot.read_message_begin()
File "thriftpy/protocol/cybin/cybin.pyx", line 439, in cybin.TCyBinaryProtocol.read_message_begin
cybin.ProtocolError: No protocol version header
i find the cause. the python use BIO.so we can not use NIO. can u tell me how to set the parameter
As @electrum mentioned, Thrift server implementations other than Drift require that clients have prior knowledge of the exact transport and protocol. In your case I'm pretty sure your server is using an the unframed transport, and the binary protocol. The preferred transport is framed, which if at all possible you should switch your server to use as it is much more efficient. That said, you can change the Drift client to use unframed by calling setTransport(UNFRAMED
on DriftNettyClientConfig
.
thank you,and i had resolved that problem. it indeed caused by transport.when i use un transport.it works
i use java client and python server. when i use drift,it throw error. but when i use thrift-api,it work.
the following code is mine. can u help me? thanks
Interface NLU
Main
Exception