Re: pyrolite - java error if remote object includes further libs in called method

Irmen de Jong <[email protected]>
Newsgroups gmane.comp.python.pyro
Message-ID <[email protected]>
On 14-6-2013 22:50, Irmen de Jong wrote:
> I don't have experience with numpy though. Is list(some-numpy-type) doing something odd?
> What are the elements of the resulting list?

I've reproduced the problem and it is caused by numpy:

>>> import numpy
>>> x=numpy.array([1.0, 2.0])
>>> y=list(x)
>>> y
[1.0, 2.0]
>>> type(y[0])
<type 'numpy.float64'>
>>>

So when you return list(x) from your Pyro object, it will still contain serialized numpy
types. Pyrolite doesn't support numpy types (yet).

A workaround is to convert the numpy array to a regular Python array.array, which Pyro
(and Pyrolite) support just fine. Or use self.x.tolist() to convert the numpy array to a
regular python list where the data items are also converted to normal python types.

In the first case you'll get a double[] in Java, in the second case ArrayList<Double>.

The java exception that you got is a bit cryptic but that is due to the way the pickle
protocol works internally...


Irmen


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.