|
RE: fromstring doesn't accept buffer object: msg#00065python.numeric.general
Sorry for mixing test and production systems: There is no problem here with python 2.3, I got this failure with python 2.4a2: ========================================== import numarray as n import Numeric as N s = '12341234' b = buffer(s) print 'numarray: fromstring (string ..) :' print n.fromstring(s, type=n.Float64) print 'Numeric: fromstring (string ..) :' print N.fromstring(s, typecode=N.Float64) print 'Numeric: fromstring (buffer ..) :' print N.fromstring(b, typecode=N.Float64) print 'numarray: fromstring (buffer ..) :' print n.fromstring(b, type=n.Float64) === Results: ==== numarray: fromstring (string ..) : [ 3.05810932e-57] Numeric: fromstring (string ..) : [ 3.05810932e-57] Numeric: fromstring (buffer ..) : [ 3.05810932e-57] === This error happens only with Python 2.4.a2: numarray: fromstring (buffer ..) : Traceback (most recent call last): File "test.py", line 17, in ? print n.fromstring(b, type=n.Float64) File "/usr/local/lib/python2.4/site-packages/numarray/numarraycore.py", line 378, in fromstring arr._data, 0, (type.bytes,), type.bytes) libnumarray.error: copyNbytes: access beyond buffer. offset=7 buffersize=0 Nadav. -----Original Message----- From: Todd Miller [mailto:jmiller@xxxxxxxxx] Sent: Thu 26-Aug-04 15:51 To: Nadav Horesh Cc: numpy-discussion Subject: Re: [Numpy-discussion] fromstring doesn't accept buffer object This is what I see this morning using CVS: >>> from numarray import * >>> s = "thisthis" >>> fromstring(buffer(s), shape=(2,), type=Int32) array([1936287860, 1936287860]) What kind of failure are you seeing? Regards, Todd On Thu, 2004-08-26 at 09:28, Nadav Horesh wrote: > Numerc accepts a buffer object instead of a string: > > arr = Numeric.fromstring(buffer(.some_string), ..) > while numarray doesn't. > > Is it intentional? > > Nadav. > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion@xxxxxxxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/numpy-discussion -- ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: fromstring doesn't accept buffer object: 00065, Todd Miller |
|---|---|
| Next by Date: | Confusion regarding Numeric array resizing: 00065, Jp Calderone |
| Previous by Thread: | Re: fromstring doesn't accept buffer objecti: 00065, Todd Miller |
| Next by Thread: | Confusion regarding Numeric array resizing: 00065, Jp Calderone |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |