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

Delivering complex objects to the remote fails if the remote cannot unpickle them #7

Open
pilcru opened this issue Feb 27, 2018 · 0 comments

Comments

@pilcru
Copy link
Owner

pilcru commented Feb 27, 2018

For example, trying to deliver a (remote) numpy array. Probably this does not even make sense: we shouldn't deliver something that is already on the remote. Similarly, sending b"a" from IronPython 2 to CPython 2 won't work because it represents a call to bytes(u'a', 'latin-1') in IronPython, that CPython has no chance of understanding since bytes == str, which only takes one argument (no encoding).

But maybe this might hint at other issues when passing around netrefs or function calls.

>>> np = sc.sticky['numpy']
>>> rpyc.utils.classic.deliver(rpy, np.array(10))

Runtime error (Exception): TypeError
Traceback:
  line 516, in sync_request, "C:\Users\pcuvil.WIN\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\core\protocol.py"
  line 78, in syncreq, "C:\Users\pcuvil.WIN\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\core\netref.py"
  line 212, in __call__, "C:\Users\pcuvil.WIN\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\core\netref.py"
  line 292, in deliver, "C:\Users\pcuvil.WIN\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\utils\classic.py"
  line 58, in script

--- Remote traceback: ---
Exception caught
Traceback (most recent call last):
  File "c:\tools\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 342, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
  File "c:\tools\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 638, in _handle_call
    return obj(*args, **dict(kwargs))
TypeError: ('loads() argument 1 must be string, not unicode', <built-in function loads>, (u"cnumpy.core.multiarray\n_rec
onstruct\np1\n(cnumpy\nndarray\np2\n(I0\ntS'b'\ntRp3\n(I1\n(tcnumpy\ndtype\np4\n(S'i4'\nI0\nI1\ntRp5\n(I3\nS'<'\nNNNI-1\
nI-1\nI0\ntbI00\nS'\\n\\x00\\x00\\x00'\ntb.",))
>>> rpyc.utils.classic.deliver(rpy, b"a")
(Same local traceback)

--- Remote traceback ---
Exception caught
Traceback (most recent call last):
  File "c:\tools\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 342, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
  File "c:\tools\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 638, in _handle_call
    return obj(*args, **dict(kwargs))
TypeError: ('str() takes at most 1 argument (2 given)', <type 'str'>, (u's', u'latin-1'))

Forcing casting to bytes in rpyc.utils.classic.obtain or rpyc.core.netref.__array__ doesn't fix it.

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

No branches or pull requests

1 participant