cPickle.UnpicklingError:无效的加载密钥
我的程序在 Windows 上运行良好,使用 cpickle,并且我使用二进制模式,如“wb”或“rb”。当我在 Linux 上运行我的程序时,它仍然运行良好。
但是,当我尝试在 Windows 平台上取消从 Linux 平台获取的文件时,我收到此有线消息:cPickle.UnpicklingError: invalid load key' '。
谁能告诉我为什么吗?
看来我无法从 Linux 平台上 unpickle 任何文件。
顺便说一句,我运行的两个程序是相同的。
谢谢一百万。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看代码(http:// /svn.python.org/view/python/trunk/Modules/cPickle.c?revision=81029&view=markup),看起来这是一个解析错误(加载键是一个pickle格式键)。听起来文件已被更改。
文件是如何从 Linux 传输到 Windows 的?如果是FTP,你是用二进制方式传输的吗?
(您使用的是 HIGHEST_PROTOCOL 对吗?)
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?)