cPickle.UnpicklingError: invalid load key

2019-05-02 10:25发布

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.

标签: python pickle
1条回答
Animai°情兽
2楼-- · 2019-05-02 10:54

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?)

查看更多
登录 后发表回答