python thrift error ```TSocket read 0 bytes```

笑着哭i 提交于 2019-12-04 06:09:40

I guess this question is old, but I hit the same error message. It turned out that there was a typo on the server side. The thrift libraries were trying to log the message using Python logging, but I hadn't set up logging, so it just said, "No handlers could be found for logger "thrift.server.TServer"".

When I did some minimal logging, (add this code to the server side):

import logging
logging.basicConfig(level=logging.DEBUG)

The logging showed me my typo in a Python stack trace, I fixed it and it worked again. The "TSocket read 0 bytes" error means the server got an exception and didn't write out a message.

My OS environment problems.
I change port 30303 to 9999, it run successfully.

When you start the thrift service ,you need set protocol,like this: ./hbase-daemon.sh start thrift -c compact protocol; In your code,you need set protocol = 'compact',like thie:con = happybase.Connection(host='localhost',port=your thriftport,autoconnect=True,protocol = 'compact',timeout = xxx)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!