[Numpy-discussion] persistent ImportError: No module named multiarray when moving cPickle files between machines
Reckoner
reckoner@gmail....
Thu Nov 5 14:11:32 CST 2009
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?
Also, for my own edification, how did you know that my "pickle files
produced on Windows were contaminated by \r\n line feeds".
Thanks again!
On Thu, Nov 5, 2009 at 5:47 AM, Pauli Virtanen <pav+sp@iki.fi> wrote:
> Wed, 04 Nov 2009 19:21:57 -0800, Reckoner wrote:
>> Bruce :
>> The file in question was created as shown in the prior e-mail. Here it
>> is again:
>>
>>>> cPickle.dump(a,open('from32bitxp.pkl','w'))
>
> Your pickle files produced on Windows are contaminated by \r\n line
> feeds. AFAIK, pickle is supposed to be a binary stream.
>
> You need to open the files in binary 'wb' mode, not in text 'w' mode.
>
> --
> Pauli Virtanen
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the NumPy-Discussion
mailing list