cPickle.UnpicklingError: invalid load key

匿名 (未验证) 提交于 2019-12-03 08:46:08

问题:

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.

回答1:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!