You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Attila Nagy (JIRA)" <ji...@apache.org> on 2011/02/16 12:38:57 UTC

[jira] Created: (THRIFT-1062) Problems with python tutorials

Problems with python tutorials
------------------------------

                 Key: THRIFT-1062
                 URL: https://issues.apache.org/jira/browse/THRIFT-1062
             Project: Thrift
          Issue Type: Bug
          Components: Python - Library, Tutorial
    Affects Versions: 0.7
         Environment: Thrift trunk (svn rev:1071191), python 2.7, FreeBSD/amd64 8-stable
            Reporter: Attila Nagy


I'm trying to do some experiments with python and thrift, starting with the tutorials in the source code.
First test: making tutorials/py.twisted client and server interact.
Started the server with: tutorial/py.twisted]# python PythonServer.py
and the client with:
tutorial/py.twisted]# python PythonClient.py
Traceback (most recent call last):
  File "PythonClient.py", line 26, in <module>
    from tutorial import Calculator
ImportError: No module named tutorial

The problem is that PythonClient uses the python and not the py.twisted path: sys.path.append('../gen-py')
changing that to gen-py.twisted solves the problem:
tutorial/py.twisted]# python PythonClient.py
ping()
1+1=2
InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
15-10=5
Check log: 5

Second test: make python twisted server work with python (not the twisted one) client:
tutorial/py.twisted]# python PythonServer.py
tutorial/py]# python PythonClient.py 
TSocket read 0 bytes

Please note here, that the server listens only on IPv4, 127.0.0.1, while the clients connects to 'localhost', which resolves to ::1 (IPv6) and 127.0.0.1, so the first connection request is refused and only the seconds succeeds:
12:07:24.887750 IP6 ::1.45100 > ::1.9090: Flags [S], seq 445533509, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
12:07:24.887785 IP6 ::1.9090 > ::1.45100: Flags [R.], seq 0, ack 445533510, win 0, length 0
12:07:24.887924 IP 127.0.0.1.48945 > 127.0.0.1.9090: Flags [S], seq 3667752274, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
12:07:24.887948 IP 127.0.0.1.9090 > 127.0.0.1.48945: Flags [S.], seq 3988782459, ack 3667752275, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 1390952173 ecr 7743539], length 0
Changing localhost to 127.0.0.1 (to work around the first IPv6 connection request) changes nothing:
  transport = TSocket.TSocket('localhost', 9090) -> transport = TSocket.TSocket('127.0.0.1', 9090)
tutorial/py]# python PythonClient.py 
TSocket read 0 bytes

Trying the other way: starting the python server and connecting with python client:
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/site-packages/thrift/server/TServer.py", line 74, in serve
    self.serverTransport.listen()
  File "/usr/local/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 136, in listen
    res0 = self._resolveAddr()
  File "/usr/local/lib/python2.7/site-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
Here it seems the problem is that no host has been given, and getaddrinfo fails on that.
Giving the listen address explicitly:
transport = TSocket.TServerSocket(9090) -> transport = TSocket.TServerSocket('127.0.0.1',9090)
makes the server start.
Connecting with the client:
tutorial/py]# python PythonClient.py 
ping()
1+1=2
InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
15-10=5
Check log: 5
gives the expected result. So the python client can interact with the python server, but the 

Looking at the code, I can't see why these two can't interact. BTW, I've tried the Ruby client, and it can work with the python server, but not with the python twisted server.
So I guess python twisted server (and so the client) is incompatible with everything else. Which seems pretty bad...
Or I'm just on the wrong track somewhere.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (THRIFT-1062) Problems with python tutorials

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier resolved THRIFT-1062.
---------------------------------

    Resolution: Incomplete
      Assignee: Roger Meier

THRIFT-1735 integrates Python Tutorials into regular build

please create a test case for the test suite:
- test/test.sh (interoperability)
- test/py/
- test/py.twisted


                
> Problems with python tutorials
> ------------------------------
>
>                 Key: THRIFT-1062
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1062
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library, Tutorial
>    Affects Versions: 0.7
>         Environment: Thrift trunk (svn rev:1071191), python 2.7, FreeBSD/amd64 8-stable
>            Reporter: Attila Nagy
>            Assignee: Roger Meier
>
> I'm trying to do some experiments with python and thrift, starting with the tutorials in the source code.
> First test: making tutorials/py.twisted client and server interact.
> Started the server with: tutorial/py.twisted]# python PythonServer.py
> and the client with:
> tutorial/py.twisted]# python PythonClient.py
> Traceback (most recent call last):
>   File "PythonClient.py", line 26, in <module>
>     from tutorial import Calculator
> ImportError: No module named tutorial
> The problem is that PythonClient uses the python and not the py.twisted path: sys.path.append('../gen-py')
> changing that to gen-py.twisted solves the problem:
> tutorial/py.twisted]# python PythonClient.py
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> Second test: make python twisted server work with python (not the twisted one) client:
> tutorial/py.twisted]# python PythonServer.py
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Please note here, that the server listens only on IPv4, 127.0.0.1, while the clients connects to 'localhost', which resolves to ::1 (IPv6) and 127.0.0.1, so the first connection request is refused and only the seconds succeeds:
> 12:07:24.887750 IP6 ::1.45100 > ::1.9090: Flags [S], seq 445533509, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887785 IP6 ::1.9090 > ::1.45100: Flags [R.], seq 0, ack 445533510, win 0, length 0
> 12:07:24.887924 IP 127.0.0.1.48945 > 127.0.0.1.9090: Flags [S], seq 3667752274, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887948 IP 127.0.0.1.9090 > 127.0.0.1.48945: Flags [S.], seq 3988782459, ack 3667752275, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 1390952173 ecr 7743539], length 0
> Changing localhost to 127.0.0.1 (to work around the first IPv6 connection request) changes nothing:
>   transport = TSocket.TSocket('localhost', 9090) -> transport = TSocket.TSocket('127.0.0.1', 9090)
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Trying the other way: starting the python server and connecting with python client:
> 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/site-packages/thrift/server/TServer.py", line 74, in serve
>     self.serverTransport.listen()
>   File "/usr/local/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 136, in listen
>     res0 = self._resolveAddr()
>   File "/usr/local/lib/python2.7/site-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
> Here it seems the problem is that no host has been given, and getaddrinfo fails on that.
> Giving the listen address explicitly:
> transport = TSocket.TServerSocket(9090) -> transport = TSocket.TServerSocket('127.0.0.1',9090)
> makes the server start.
> Connecting with the client:
> tutorial/py]# python PythonClient.py 
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> gives the expected result. So the python client can interact with the python server, but the 
> Looking at the code, I can't see why these two can't interact. BTW, I've tried the Ruby client, and it can work with the python server, but not with the python twisted server.
> So I guess python twisted server (and so the client) is incompatible with everything else. Which seems pretty bad...
> Or I'm just on the wrong track somewhere.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1062) Problems with python tutorials

Posted by "FEIFAN (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13271641#comment-13271641 ] 

FEIFAN commented on THRIFT-1062:
--------------------------------

@Viacheslav
I met this problem too, then I did some inspection. That's because twisted add a 4 bytes INT length in front of the real data.
check my blog:
http://blog.thisisfeifan.com/2012/05/thrift-twisted-server-not-twisted.html

                
> Problems with python tutorials
> ------------------------------
>
>                 Key: THRIFT-1062
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1062
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library, Tutorial
>    Affects Versions: 0.7
>         Environment: Thrift trunk (svn rev:1071191), python 2.7, FreeBSD/amd64 8-stable
>            Reporter: Attila Nagy
>
> I'm trying to do some experiments with python and thrift, starting with the tutorials in the source code.
> First test: making tutorials/py.twisted client and server interact.
> Started the server with: tutorial/py.twisted]# python PythonServer.py
> and the client with:
> tutorial/py.twisted]# python PythonClient.py
> Traceback (most recent call last):
>   File "PythonClient.py", line 26, in <module>
>     from tutorial import Calculator
> ImportError: No module named tutorial
> The problem is that PythonClient uses the python and not the py.twisted path: sys.path.append('../gen-py')
> changing that to gen-py.twisted solves the problem:
> tutorial/py.twisted]# python PythonClient.py
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> Second test: make python twisted server work with python (not the twisted one) client:
> tutorial/py.twisted]# python PythonServer.py
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Please note here, that the server listens only on IPv4, 127.0.0.1, while the clients connects to 'localhost', which resolves to ::1 (IPv6) and 127.0.0.1, so the first connection request is refused and only the seconds succeeds:
> 12:07:24.887750 IP6 ::1.45100 > ::1.9090: Flags [S], seq 445533509, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887785 IP6 ::1.9090 > ::1.45100: Flags [R.], seq 0, ack 445533510, win 0, length 0
> 12:07:24.887924 IP 127.0.0.1.48945 > 127.0.0.1.9090: Flags [S], seq 3667752274, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887948 IP 127.0.0.1.9090 > 127.0.0.1.48945: Flags [S.], seq 3988782459, ack 3667752275, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 1390952173 ecr 7743539], length 0
> Changing localhost to 127.0.0.1 (to work around the first IPv6 connection request) changes nothing:
>   transport = TSocket.TSocket('localhost', 9090) -> transport = TSocket.TSocket('127.0.0.1', 9090)
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Trying the other way: starting the python server and connecting with python client:
> 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/site-packages/thrift/server/TServer.py", line 74, in serve
>     self.serverTransport.listen()
>   File "/usr/local/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 136, in listen
>     res0 = self._resolveAddr()
>   File "/usr/local/lib/python2.7/site-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
> Here it seems the problem is that no host has been given, and getaddrinfo fails on that.
> Giving the listen address explicitly:
> transport = TSocket.TServerSocket(9090) -> transport = TSocket.TServerSocket('127.0.0.1',9090)
> makes the server start.
> Connecting with the client:
> tutorial/py]# python PythonClient.py 
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> gives the expected result. So the python client can interact with the python server, but the 
> Looking at the code, I can't see why these two can't interact. BTW, I've tried the Ruby client, and it can work with the python server, but not with the python twisted server.
> So I guess python twisted server (and so the client) is incompatible with everything else. Which seems pretty bad...
> Or I'm just on the wrong track somewhere.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1062) Problems with python tutorials

Posted by "Viacheslav Mironov (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13177597#comment-13177597 ] 

Viacheslav Mironov commented on THRIFT-1062:
--------------------------------------------

I pull and install last revision 1225773, and install python thrift library from lib direcory. 

Then I compile py.twisted and py modules:
$ thrift -r --gen py tutorial.thrift
$ thrift -r --gen py:twisted tutorial.thrift

After it at first console I run server:
$ cd py.twisted
$ python PythonServer.py

And on second console I run python client (not twisted(!)) and get error:
$ cd py
$ python PythonClient.py 
TSocket read 0 bytes

I see that twisted server does not work correctly with not-twisted clients.
                
> Problems with python tutorials
> ------------------------------
>
>                 Key: THRIFT-1062
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1062
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library, Tutorial
>    Affects Versions: 0.7
>         Environment: Thrift trunk (svn rev:1071191), python 2.7, FreeBSD/amd64 8-stable
>            Reporter: Attila Nagy
>
> I'm trying to do some experiments with python and thrift, starting with the tutorials in the source code.
> First test: making tutorials/py.twisted client and server interact.
> Started the server with: tutorial/py.twisted]# python PythonServer.py
> and the client with:
> tutorial/py.twisted]# python PythonClient.py
> Traceback (most recent call last):
>   File "PythonClient.py", line 26, in <module>
>     from tutorial import Calculator
> ImportError: No module named tutorial
> The problem is that PythonClient uses the python and not the py.twisted path: sys.path.append('../gen-py')
> changing that to gen-py.twisted solves the problem:
> tutorial/py.twisted]# python PythonClient.py
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> Second test: make python twisted server work with python (not the twisted one) client:
> tutorial/py.twisted]# python PythonServer.py
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Please note here, that the server listens only on IPv4, 127.0.0.1, while the clients connects to 'localhost', which resolves to ::1 (IPv6) and 127.0.0.1, so the first connection request is refused and only the seconds succeeds:
> 12:07:24.887750 IP6 ::1.45100 > ::1.9090: Flags [S], seq 445533509, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887785 IP6 ::1.9090 > ::1.45100: Flags [R.], seq 0, ack 445533510, win 0, length 0
> 12:07:24.887924 IP 127.0.0.1.48945 > 127.0.0.1.9090: Flags [S], seq 3667752274, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887948 IP 127.0.0.1.9090 > 127.0.0.1.48945: Flags [S.], seq 3988782459, ack 3667752275, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 1390952173 ecr 7743539], length 0
> Changing localhost to 127.0.0.1 (to work around the first IPv6 connection request) changes nothing:
>   transport = TSocket.TSocket('localhost', 9090) -> transport = TSocket.TSocket('127.0.0.1', 9090)
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Trying the other way: starting the python server and connecting with python client:
> 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/site-packages/thrift/server/TServer.py", line 74, in serve
>     self.serverTransport.listen()
>   File "/usr/local/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 136, in listen
>     res0 = self._resolveAddr()
>   File "/usr/local/lib/python2.7/site-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
> Here it seems the problem is that no host has been given, and getaddrinfo fails on that.
> Giving the listen address explicitly:
> transport = TSocket.TServerSocket(9090) -> transport = TSocket.TServerSocket('127.0.0.1',9090)
> makes the server start.
> Connecting with the client:
> tutorial/py]# python PythonClient.py 
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> gives the expected result. So the python client can interact with the python server, but the 
> Looking at the code, I can't see why these two can't interact. BTW, I've tried the Ruby client, and it can work with the python server, but not with the python twisted server.
> So I guess python twisted server (and so the client) is incompatible with everything else. Which seems pretty bad...
> Or I'm just on the wrong track somewhere.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1062) Problems with python tutorials

Posted by "Jake Farrell (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13177518#comment-13177518 ] 

Jake Farrell commented on THRIFT-1062:
--------------------------------------

Looking at the current trunk r1225728 your first two issues have all ready been addressed. both the twisted client and server tutorials are using 127.0.0.1 to connect with and have sys.path.append('../gen-py.twisted')
                
> Problems with python tutorials
> ------------------------------
>
>                 Key: THRIFT-1062
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1062
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library, Tutorial
>    Affects Versions: 0.7
>         Environment: Thrift trunk (svn rev:1071191), python 2.7, FreeBSD/amd64 8-stable
>            Reporter: Attila Nagy
>
> I'm trying to do some experiments with python and thrift, starting with the tutorials in the source code.
> First test: making tutorials/py.twisted client and server interact.
> Started the server with: tutorial/py.twisted]# python PythonServer.py
> and the client with:
> tutorial/py.twisted]# python PythonClient.py
> Traceback (most recent call last):
>   File "PythonClient.py", line 26, in <module>
>     from tutorial import Calculator
> ImportError: No module named tutorial
> The problem is that PythonClient uses the python and not the py.twisted path: sys.path.append('../gen-py')
> changing that to gen-py.twisted solves the problem:
> tutorial/py.twisted]# python PythonClient.py
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> Second test: make python twisted server work with python (not the twisted one) client:
> tutorial/py.twisted]# python PythonServer.py
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Please note here, that the server listens only on IPv4, 127.0.0.1, while the clients connects to 'localhost', which resolves to ::1 (IPv6) and 127.0.0.1, so the first connection request is refused and only the seconds succeeds:
> 12:07:24.887750 IP6 ::1.45100 > ::1.9090: Flags [S], seq 445533509, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887785 IP6 ::1.9090 > ::1.45100: Flags [R.], seq 0, ack 445533510, win 0, length 0
> 12:07:24.887924 IP 127.0.0.1.48945 > 127.0.0.1.9090: Flags [S], seq 3667752274, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887948 IP 127.0.0.1.9090 > 127.0.0.1.48945: Flags [S.], seq 3988782459, ack 3667752275, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 1390952173 ecr 7743539], length 0
> Changing localhost to 127.0.0.1 (to work around the first IPv6 connection request) changes nothing:
>   transport = TSocket.TSocket('localhost', 9090) -> transport = TSocket.TSocket('127.0.0.1', 9090)
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Trying the other way: starting the python server and connecting with python client:
> 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/site-packages/thrift/server/TServer.py", line 74, in serve
>     self.serverTransport.listen()
>   File "/usr/local/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 136, in listen
>     res0 = self._resolveAddr()
>   File "/usr/local/lib/python2.7/site-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
> Here it seems the problem is that no host has been given, and getaddrinfo fails on that.
> Giving the listen address explicitly:
> transport = TSocket.TServerSocket(9090) -> transport = TSocket.TServerSocket('127.0.0.1',9090)
> makes the server start.
> Connecting with the client:
> tutorial/py]# python PythonClient.py 
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> gives the expected result. So the python client can interact with the python server, but the 
> Looking at the code, I can't see why these two can't interact. BTW, I've tried the Ruby client, and it can work with the python server, but not with the python twisted server.
> So I guess python twisted server (and so the client) is incompatible with everything else. Which seems pretty bad...
> Or I'm just on the wrong track somewhere.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (THRIFT-1062) Problems with python tutorials

Posted by "Viacheslav Mironov (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13177074#comment-13177074 ] 

Viacheslav Mironov edited comment on THRIFT-1062 at 12/29/11 8:58 AM:
----------------------------------------------------------------------

This bug still available in version 0.8

My message in mailing list: 
http://mail-archives.apache.org/mod_mbox/thrift-user/201112.mbox/raw/%3CCA%2BQX4DMKjMBk%2Bk78vmfeuvyZRiCtoHHqQctkYEaaxZxsDG5Qsg%40mail.gmail.com%3E
                
      was (Author: via):
    This bug still available in version 0.8
                  
> Problems with python tutorials
> ------------------------------
>
>                 Key: THRIFT-1062
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1062
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library, Tutorial
>    Affects Versions: 0.7
>         Environment: Thrift trunk (svn rev:1071191), python 2.7, FreeBSD/amd64 8-stable
>            Reporter: Attila Nagy
>
> I'm trying to do some experiments with python and thrift, starting with the tutorials in the source code.
> First test: making tutorials/py.twisted client and server interact.
> Started the server with: tutorial/py.twisted]# python PythonServer.py
> and the client with:
> tutorial/py.twisted]# python PythonClient.py
> Traceback (most recent call last):
>   File "PythonClient.py", line 26, in <module>
>     from tutorial import Calculator
> ImportError: No module named tutorial
> The problem is that PythonClient uses the python and not the py.twisted path: sys.path.append('../gen-py')
> changing that to gen-py.twisted solves the problem:
> tutorial/py.twisted]# python PythonClient.py
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> Second test: make python twisted server work with python (not the twisted one) client:
> tutorial/py.twisted]# python PythonServer.py
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Please note here, that the server listens only on IPv4, 127.0.0.1, while the clients connects to 'localhost', which resolves to ::1 (IPv6) and 127.0.0.1, so the first connection request is refused and only the seconds succeeds:
> 12:07:24.887750 IP6 ::1.45100 > ::1.9090: Flags [S], seq 445533509, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887785 IP6 ::1.9090 > ::1.45100: Flags [R.], seq 0, ack 445533510, win 0, length 0
> 12:07:24.887924 IP 127.0.0.1.48945 > 127.0.0.1.9090: Flags [S], seq 3667752274, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887948 IP 127.0.0.1.9090 > 127.0.0.1.48945: Flags [S.], seq 3988782459, ack 3667752275, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 1390952173 ecr 7743539], length 0
> Changing localhost to 127.0.0.1 (to work around the first IPv6 connection request) changes nothing:
>   transport = TSocket.TSocket('localhost', 9090) -> transport = TSocket.TSocket('127.0.0.1', 9090)
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Trying the other way: starting the python server and connecting with python client:
> 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/site-packages/thrift/server/TServer.py", line 74, in serve
>     self.serverTransport.listen()
>   File "/usr/local/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 136, in listen
>     res0 = self._resolveAddr()
>   File "/usr/local/lib/python2.7/site-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
> Here it seems the problem is that no host has been given, and getaddrinfo fails on that.
> Giving the listen address explicitly:
> transport = TSocket.TServerSocket(9090) -> transport = TSocket.TServerSocket('127.0.0.1',9090)
> makes the server start.
> Connecting with the client:
> tutorial/py]# python PythonClient.py 
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> gives the expected result. So the python client can interact with the python server, but the 
> Looking at the code, I can't see why these two can't interact. BTW, I've tried the Ruby client, and it can work with the python server, but not with the python twisted server.
> So I guess python twisted server (and so the client) is incompatible with everything else. Which seems pretty bad...
> Or I'm just on the wrong track somewhere.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1062) Problems with python tutorials

Posted by "Viacheslav Mironov (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13177074#comment-13177074 ] 

Viacheslav Mironov commented on THRIFT-1062:
--------------------------------------------

This bug still available in version 0.8
                
> Problems with python tutorials
> ------------------------------
>
>                 Key: THRIFT-1062
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1062
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library, Tutorial
>    Affects Versions: 0.7
>         Environment: Thrift trunk (svn rev:1071191), python 2.7, FreeBSD/amd64 8-stable
>            Reporter: Attila Nagy
>
> I'm trying to do some experiments with python and thrift, starting with the tutorials in the source code.
> First test: making tutorials/py.twisted client and server interact.
> Started the server with: tutorial/py.twisted]# python PythonServer.py
> and the client with:
> tutorial/py.twisted]# python PythonClient.py
> Traceback (most recent call last):
>   File "PythonClient.py", line 26, in <module>
>     from tutorial import Calculator
> ImportError: No module named tutorial
> The problem is that PythonClient uses the python and not the py.twisted path: sys.path.append('../gen-py')
> changing that to gen-py.twisted solves the problem:
> tutorial/py.twisted]# python PythonClient.py
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> Second test: make python twisted server work with python (not the twisted one) client:
> tutorial/py.twisted]# python PythonServer.py
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Please note here, that the server listens only on IPv4, 127.0.0.1, while the clients connects to 'localhost', which resolves to ::1 (IPv6) and 127.0.0.1, so the first connection request is refused and only the seconds succeeds:
> 12:07:24.887750 IP6 ::1.45100 > ::1.9090: Flags [S], seq 445533509, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887785 IP6 ::1.9090 > ::1.45100: Flags [R.], seq 0, ack 445533510, win 0, length 0
> 12:07:24.887924 IP 127.0.0.1.48945 > 127.0.0.1.9090: Flags [S], seq 3667752274, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 7743539 ecr 0], length 0
> 12:07:24.887948 IP 127.0.0.1.9090 > 127.0.0.1.48945: Flags [S.], seq 3988782459, ack 3667752275, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 1390952173 ecr 7743539], length 0
> Changing localhost to 127.0.0.1 (to work around the first IPv6 connection request) changes nothing:
>   transport = TSocket.TSocket('localhost', 9090) -> transport = TSocket.TSocket('127.0.0.1', 9090)
> tutorial/py]# python PythonClient.py 
> TSocket read 0 bytes
> Trying the other way: starting the python server and connecting with python client:
> 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/site-packages/thrift/server/TServer.py", line 74, in serve
>     self.serverTransport.listen()
>   File "/usr/local/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 136, in listen
>     res0 = self._resolveAddr()
>   File "/usr/local/lib/python2.7/site-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
> Here it seems the problem is that no host has been given, and getaddrinfo fails on that.
> Giving the listen address explicitly:
> transport = TSocket.TServerSocket(9090) -> transport = TSocket.TServerSocket('127.0.0.1',9090)
> makes the server start.
> Connecting with the client:
> tutorial/py]# python PythonClient.py 
> ping()
> 1+1=2
> InvalidOperation: InvalidOperation(what=4, why='Cannot divide by 0')
> 15-10=5
> Check log: 5
> gives the expected result. So the python client can interact with the python server, but the 
> Looking at the code, I can't see why these two can't interact. BTW, I've tried the Ruby client, and it can work with the python server, but not with the python twisted server.
> So I guess python twisted server (and so the client) is incompatible with everything else. Which seems pretty bad...
> Or I'm just on the wrong track somewhere.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira