[Numpy-discussion] persistent ImportError: No module named multiarray when moving cPickle files between machines

Robert Kern robert.kern at gmail.com
Thu Nov 5 15:17:07 EST 2009

On Thu, Nov 5, 2009 at 14:11, Reckoner <reckoner at gmail.com> wrote:
> Pauli :
> Thanks for your reply. Using 'wb' instead of 'w' for the file mode
> evidently makes this problem go away.
> The mystery is that why does this work with plain lists *and* 'w' and
> not with numpy arrays and 'w'. In other words, why is it that
> numpy.array needs the binary mode while list does not?

I'm not sure what to say except "because it does". Pickles don't
necessarily contain binary data, particularly using the default
protocol=0 and only builtin types, but they may. Always use 'wb'.

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

More information about the NumPy-Discussion mailing list