Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to a python 3 host from a python 2 host or vice versa fails #54

Closed
valhallasw opened this issue Oct 28, 2011 · 3 comments
Closed

Comments

@valhallasw
Copy link

(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 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 "<stdin>", line 1, in <module>
  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:

$ 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 "<stdin>", line 1, in <module>
  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:

$ 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
@tomerfiliba
Copy link
Collaborator

Hey
I'm pretty sure I wrote it somewhere... It's not possible to connect from python 2.x to 3.x and vice versa. that's because the object-model is too different between the two languages and it's impossible to map from one to the other automatically (i really did try)

I'll update the documentation when I get back and close the issue then.

Thanks for reporting.

@valhallasw
Copy link
Author

Thanks for your quick response! Do you maybe have some more specific information on the problem of mapping objects, as I thought only mapping immutables should be possible to implement cross-python..

Thanks!

tomerfiliba added a commit that referenced this issue Nov 11, 2011
@tomerfiliba
Copy link
Collaborator

@valhallasw, see the two related commits for more info. thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants