Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cPickle.UnpicklingError: invalid load key

Tags:

python

pickle

My program work fine on windows, with cpickle, and I am using binary mode, like 'wb', or 'rb'. When I ran my program on Linux, it still works fine.

But when I tried to unpickle the files obtained from the Linux platform on my windows platform, I got this wired message says: cPickle.UnpicklingError: invalid load key' '.

Can anyone please tell me why?

It seems that I could not unpickle anyfile from the Linux platform.

BTW, the two programs that I run are identical.

Thanks a million.

like image 412
beryl83 Avatar asked Oct 14 '22 00:10

beryl83


1 Answers

Looking at the code (http://svn.python.org/view/python/trunk/Modules/cPickle.c?revision=81029&view=markup), it looks like it was a parsing error (load key is a pickle format key). It sounds like the file has been altered.

How were the files transferred from Linux to Windows? If it was FTP, did you transfer in binary mode?

(You are using HIGHEST_PROTOCOL right?)

like image 188
Jeremy Brown Avatar answered Oct 27 '22 07:10

Jeremy Brown