Note that there are some explanatory texts on larger screens.

plurals
  1. POThrift : TypeError: getaddrinfo() argument 1 must be string or None
    text
    copied!<p>Hi I am trying to write a simple thrift server in python (named PythonServer.py) with a single method that returns a string for learning purposes. The server code is below. I am having the following errors in the Thrift's python libraries when I run the server. Has anyone experienced this problem and suggest a workaround?</p> <p>The execution output:</p> <pre><code> Starting server Traceback (most recent call last): File "/home/dae/workspace/BasicTestEnvironmentV1.0/src/PythonServer.py", line 38, in &lt;module&gt; server.serve() File "usr/lib/python2.6/site-packages/thrift/server/TServer.py", line 101, in serve File "usr/lib/python2.6/site-packages/thrift/transport/TSocket.py", line 136, in listen File "usr/lib/python2.6/site-packages/thrift/transport/TSocket.py", line 31, in _resolveAddr TypeError: getaddrinfo() argument 1 must be string or None </code></pre> <p>PythonServer.java</p> <pre><code> port = 9090 import MyService as myserv #from ttypes import * # Thrift files from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from thrift.server import TServer # Server implementation class MyHandler: # return server message def sendMessage(self, text): print text return 'In the garage!!!' # set handler to our implementation handler = MyHandler() processor = myserv.Processor(handler) transport = TSocket.TServerSocket(port) tfactory = TTransport.TBufferedTransportFactory() pfactory = TBinaryProtocol.TBinaryProtocolFactory() # set server server = TServer.TThreadedServer(processor, transport, tfactory, pfactory) print 'Starting server' server.serve() ##### LINE 38 GOES HERE ########## </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload