Thanks, Ziga I have submitted the bug to http://projects.scipy.org/scipy/numpy
I am using the following workaround for now: >>> import numpy >>> import pickle >>> import __builtin__ >>> __builtin__.float32_arrtype = numpy.float32 >>> pickle.dumps(numpy.float32) 'c__builtin__\nfloat32_arrtype\np0\n.' The name binding must also be present when unpickling. Iljya Kalai Ziga Seilnacht wrote: > Iljya wrote: > > I have reproduced the error with Numpy 1.0b1 > > > > The output with v.1.0b1 reads: > > PicklingError: Can't pickle <type 'float32scalar'>: it's not found as > > __builtin__.float32scalar > > > > Has anyone else encountered this? > > > > Thanks, > > > > Iljya > > > > Iljya wrote: > > > Hello, > > > > > > I need to pickle the type numpy.float32 but encounter an error when I > > > try to do so. I am able to pickle the array itself, it is specifically > > > the type that I cannot pickle. > > > > > > I am using: > > > Numpy version: 0.9.4 > > > Python version: 2.4.3 > > > Windows XP > > > > > > Here is the code that reproduces the error: > > > ______________________________________ > > > import numpy > > > import pickle > > > > > > pickle.dumps(numpy.float32) > > > > > > Output: > > > PicklingError: Can't pickle <type 'float32_arrtype'>: it's not found as > > > __builtin__.float32_arrtype > > > ______________________________________ > > > > > > Any suggestions would be much appreciated. > > > > > > Thanks, > > > > > > Iljya Kalai > > This looks like a numpy bug. It seems that float32_arrtype's name is > incomplete. Its tp_name field should start with a module name, but > since it doesn't, Python assumes that it is a builtin type: > > >>> import numpy > >>> numpy.float32.__module__ > '__builtin__' > > You should report this bug either to the numpy list: > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > or to their bug tracker: > http://projects.scipy.org/scipy/numpy > > Ziga -- http://mail.python.org/mailman/listinfo/python-list