Thrift python服务端出错 解决方法

来源:互联网 发布:跑跑卡丁车淘宝好便宜 编辑:程序博客网 时间:2024/06/06 06:54

    按照该教程做了一个php通过thrift的helloworld程序点击打开链接

结果运行出了这样的错误

解决方法:

进入/Thrift/lib/py目录中,

$sudo python setup.py install

再运行时就不报错了。


yang@debian:~/www/hadoop/thrift$ python serverpy.py
Starting the server...
Traceback (most recent call last):
  File "serverpy.py", line 38, in <module>
    server.serve()  
  File "/usr/local/lib/python2.7/dist-packages/thrift/server/TServer.py", line 75, in serve
    self.serverTransport.listen()
  File "/usr/local/lib/python2.7/dist-packages/thrift/transport/TSocket.py", line 149, in listen
    res0 = self._resolveAddr()
  File "/usr/local/lib/python2.7/dist-packages/thrift/transport/TSocket.py", line 39, in _resolveAddr
    socket.AI_PASSIVE | socket.AI_ADDRCONFIG)
TypeError: getaddrinfo() argument 1 must be string or None

  

  解决方法如下

进入server.py(我的服务端程序的名字)做以下修改

#transport = TSocket.TServerSocket(9090)
transport = TSocket.TServerSocket('localhost', 9090)

运行正常

0 0
原创粉丝点击