Thrift python服务端出错 解决方法

    按照该教程做了一个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
    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)

运行正常

你可能感兴趣的:(Thrift python服务端出错 解决方法)