tomerfiliba/rpyc — Issue #54: Connecting to a python 3 host from a python 2 host or vice versa fails
Author: valhallasw
Created: 2011-10-28 17:30:49+00:00
State: open

(sorry for the crappy blocks, this is the best I could get in markdown.... why does every site need its own parser? sigh :-) )

Paths have been slightly redacted.

From py3 to py2:

Client:
```python
Python 3.1.2 (r312:79147, Sep 27 2010, 09:45:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpyc
>>> rpyc.__version__
(3, 2, 1)
>>> c = rpyc.classic.connect('localhost')
Traceback (most recent call last):
File "", line 1, in
File "(...)/lib/python3.1/site-packages/rpyc/utils/classic.py", line 67, in connect
return factory.connect(host, port, SlaveService, ipv6 = ipv6)
File "(...)/lib/python3.1/site-packages/rpyc/utils/factory.py", line 84, in connect
return connect_stream(s, service, config)
File "(...)/lib/python3.1/site-packages/rpyc/utils/factory.py", line 45, in connect_stream
return connect_channel(Channel(stream), service = service, config = config)
File "(...)/lib/python3.1/site-packages/rpyc/utils/factory.py", line 34, in connect_channel
return Connection(service, channel, config = config)
File "(...)/lib/python3.1/site-packages/rpyc/core/protocol.py", line 136, in __init__
self._init_service()
File "(...)/lib/python3.1/site-packages/rpyc/core/protocol.py", line 139, in _init_service
self._local_root.on_connect()
File "(...)/lib/python3.1/site-packages/rpyc/core/service.py", line 143, in on_connect
self._conn.builtin = self._conn.modules.builtins
File "(...)/lib/python3.1/site-packages/rpyc/core/service.py", line 114, in __getattr__
return self[name]
File "(...)/lib/python3.1/site-packages/rpyc/core/service.py", line 111, in __getitem__
self.__cache[name] = self.__getmodule(name)
TypeError: 'b'instancemethod'' object is not callable
```

Server:
```python
$ python2 ./rpyc_classic.py
INFO:SLAVE/18812:server started on [0.0.0.0]:18812
INFO:SLAVE/18812:accepted 127.0.0.1:38119
INFO:SLAVE/18812:welcome [127.0.0.1]:38119
```

Other way around:
Client:
```
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpyc
>>> rpyc.__version__
(3, 2, 1)
>>> c = rpyc.classic.connect('localhost')
Traceback (most recent call last):
File "", line 1, in
File "(...)/lib/python2.6/site-packages/rpyc/utils/classic.py", line 67, in connect
return factory.connect(host, port, SlaveService, ipv6 = ipv6)
File "(...)/lib/python2.6/site-packages/rpyc/utils/factory.py", line 84, in connect
return connect_stream(s, service, config)
File "(...)/lib/python2.6/site-packages/rpyc/utils/factory.py", line 45, in connect_stream
return connect_channel(Channel(stream), service = service, config = config)
File "(...)/lib/python2.6/site-packages/rpyc/utils/factory.py", line 34, in connect_channel
return Connection(service, channel, config = config)
File "(...)/lib/python2.6/site-packages/rpyc/core/protocol.py", line 136, in __init__
self._init_service()
File "(...)/lib/python2.6/site-packages/rpyc/core/protocol.py", line 139, in _init_service
self._local_root.on_connect()
File "(...)/lib/python2.6/site-packages/rpyc/core/service.py", line 145, in on_connect
self._conn.builtin = self._conn.modules.__builtin__
File "(...)/lib/python2.6/site-packages/rpyc/core/service.py", line 114, in __getattr__
return self[name]
File "(...)/lib/python2.6/site-packages/rpyc/core/service.py", line 111, in __getitem__
self.__cache[name] = self.__getmodule(name)
File "(...)/lib/python2.6/site-packages/rpyc/core/netref.py", line 194, in __call__
return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
File "(...)/lib/python2.6/site-packages/rpyc/core/netref.py", line 69, in syncreq
return conn().sync_request(handler, oid, *args)
File "(...)/lib/python2.6/site-packages/rpyc/core/protocol.py", line 423, in sync_request
self.serve(0.1)
File "(...)/lib/python2.6/site-packages/rpyc/core/protocol.py", line 371, in serve
data = self._recv(timeout, wait_for_lock = True)
File "(...)/lib/python2.6/site-packages/rpyc/core/protocol.py", line 329, in _recv
data = self._channel.recv()
File "(...)/lib/python2.6/site-packages/rpyc/core/channel.py", line 50, in recv
header = self.stream.read(self.FRAME_HEADER.size)
File "(...)/lib/python2.6/site-packages/rpyc/core/stream.py", line 169, in read
raise EOFError("connection closed by peer")
EOFError: connection closed by peer
```

Server:
```python
$ python3 ./rpyc_classic.py
INFO:SLAVE/18812:server started on [0.0.0.0]:18812
INFO:SLAVE/18812:accepted 127.0.0.1:53998
INFO:SLAVE/18812:welcome [127.0.0.1]:53998
INFO:SLAVE/18812:goodbye [127.0.0.1]:53998
ERROR:SLAVE/18812:client connection terminated abruptly
Traceback (most recent call last):
File "(...)/lib/python3.1/site-packages/rpyc/utils/server.py", line 165, in _authenticate_and_serve_client
self._serve_client(sock2, credentials)
File "(...)/lib/python3.1/site-packages/rpyc/utils/server.py", line 189, in _serve_client
conn._init_service()
File "(...)/lib/python3.1/site-packages/rpyc/core/protocol.py", line 139, in _init_service
self._local_root.on_connect()
File "(...)/lib/python3.1/site-packages/rpyc/core/service.py", line 143, in on_connect
self._conn.builtin = self._conn.modules.builtins
File "(...)/lib/python3.1/site-packages/rpyc/core/service.py", line 114, in __getattr__
return self[name]
File "(...)/lib/python3.1/site-packages/rpyc/core/service.py", line 111, in __getitem__
self.__cache[name] = self.__getmodule(name)
TypeError: 'b'instancemethod'' object is not callable
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.1/threading.py", line 516, in _bootstrap_inner
self.run()
File "/usr/lib/python3.1/threading.py", line 469, in run
self._target(*self._args, **self._kwargs)
File "(...)/lib/python3.1/site-packages/rpyc/utils/server.py", line 165, in _authenticate_and_serve_client
self._serve_client(sock2, credentials)
File "(...)/lib/python3.1/site-packages/rpyc/utils/server.py", line 189, in _serve_client
conn._init_service()
File "(...)/lib/python3.1/site-packages/rpyc/core/protocol.py", line 139, in _init_service
self._local_root.on_connect()
File "(...)/lib/python3.1/site-packages/rpyc/core/service.py", line 143, in on_connect
self._conn.builtin = self._conn.modules.builtins
File "(...)/lib/python3.1/site-packages/rpyc/core/service.py", line 114, in __getattr__
return self[name]
File "(...)/lib/python3.1/site-packages/rpyc/core/service.py", line 111, in __getitem__
self.__cache[name] = self.__getmodule(name)
TypeError: 'b'instancemethod'' object is not callable
```