Tuesday, April 17, 2012

An Error in thrift python sample


root@ubuntu:/home/feifan/Desktop/thrift-0.8.0/tutorial/py# python PythonServer.py 
Starting the server...
Traceback (most recent call last):
  File "PythonServer.py", line 95, in <module>
    server.serve()
  File "/usr/local/lib/python2.7/dist-packages/thrift/server/TServer.py", line 74, in serve
    self.serverTransport.listen()
  File "/usr/local/lib/python2.7/dist-packages/thrift/transport/TSocket.py", line 136, in listen
    res0 = self._resolveAddr()
  File "/usr/local/lib/python2.7/dist-packages/thrift/transport/TSocket.py", line 31, in _resolveAddr
    return socket.getaddrinfo(self.host, self.port, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, socket.AI_PASSIVE | socket.AI_ADDRCONFIG)
TypeError: getaddrinfo() argument 1 must be string or None

How to Fix:
maybe construction method of class TServerSocket had been changed from a previous version, so, modify file <PythonServer.py>:

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


No comments:

Post a Comment