From: Paul F. D. <du...@ll...> - 2001-06-05 18:16:26
|
Travis: Works for me ....using either dump or dumps, load or loads I used Numeric 20.1.0b1 / Python 2.1 / RedHat 6.2 On Tue, 05 Jun 2001, Tavis Rudd wrote: > Hi, > I've been having difficultly pickling arrays with the > type PyObject using Numeric. I haven't tried it with > MA but I assume the same problem exists. >=20 > This script works > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > from cPickle import dump, load > from Numeric import array, PyObject >=20 > def pickleIt(obj, fileName): > fp =3D open(fileName, 'w') > dump(obj, fp) > fp.close >=20 > def loadIt(fileName): > fp =3D open(fileName, 'r') > obj =3D load(fp) > fp.close() > return obj >=20 > a =3D array(['abc', 'def', 'ghi'], PyObject) > pickleIt(a, 'test.pickle') >=20 > This script segfaults > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > # ... same imports and func defs as above > b =3D loadIt() > print b >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > I first noticed this when trying to pickle arrays constructed > from lists of mx.DateTime objects. >=20 > Numeric 19.1.0 > Python 2.1 final > Linux 2.2.18 >=20 > Is this a reproduceable bug or something unique to my=20 > setup? > Tavis >=20 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > http://lists.sourceforge.net/lists/listinfo/numpy-discussion |