[Numpy-discussion] Serializing numpy record array

Vishal Rana ranavishal@gmail....
Sun Jun 13 20:10:20 CDT 2010


There is no error on python side but on flex client which is "*Channel*.*
Call*.*Failed*" faultDetail="NetConnection.Call.Failed: *HTTP*: Status 503"

Here is the documentation for type mapping flex vs python:
http://pyamf.org/architecture/typemap.html, pyamf takes python data types so
I am not sure if numpy dtypes will work with it or not, but it working on
Mac OS X.

Vishal Rana

On Sun, Jun 13, 2010 at 6:04 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On Sun, Jun 13, 2010 at 19:52, Vishal Rana <ranavishal@gmail.com> wrote:
> > I created a record array (from strings and floats) with no dtype defined
> as:
> > ra = np.core.records.fromrecords(sq_list, names=("a", "b", "c"))
> > ra.a is found to be of type numpy.float64, when I serialize it using
> pyamf
> > under Mac OS X it works great but under ubuntu 10.04 it fails. Looks like
> > serialization is failing for type numpy.float64.
> Please don't just say that something fails. Show us exactly what you
> did (copy-and-paste a minimal, but complete example of the code that
> fails) and show us exactly what errors you get (copy-and-paste the
> tracebacks).
> Since I'm sure most of us here aren't familiar with the details of
> PyAMF, perhaps you can read its documentation or its code to determine
> exactly how it is trying to serialize objects and tell us that. Is it
> using pickle? Is it using its own scheme?
> > Is the any work around, I
> > was trying to set dtype=object is that ok?
> Probably not what you want.
> > Also how can I set same dtype (for eg. object) for all a, b, and c?
> In [3]: x = np.rec.fromrecords([('string', 10, 15.5)], names=['a', 'b',
> 'c'])
> In [4]: x
> Out[4]:
> rec.array([('string', 10, 15.5)],
>      dtype=[('a', '|S6'), ('b', '<i4'), ('c', '<f8')])
> In [5]: x.astype(np.dtype([('a', object), ('b', object), ('c', object)]))
> Out[5]:
> rec.array([('string', 10, 15.5)],
>      dtype=[('a', '|O4'), ('b', '|O4'), ('c', '|O4')])
> --
> Robert Kern
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
>  -- Umberto Eco
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100613/e3351ef5/attachment.html 

More information about the NumPy-Discussion mailing list