cPickle.UnpicklingError:无效的加载密钥 [英] cPickle.UnpicklingError: invalid load key

查看:502
本文介绍了cPickle.UnpicklingError:无效的加载密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序在Windows上正常工作,带有斑点,并且我正在使用二进制模式,例如'wb'或'rb'.当我在Linux上运行程序时,它仍然可以正常工作.

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.

但是,当我尝试在Windows平台上释放从Linux平台获取的文件时,我得到了以下有线消息:cPickle.UnpicklingError:无效的加载密钥' '.

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?

看来我无法从Linux平台释放任何文件.

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

顺便说一句,我运行的两个程序是相同的.

BTW, the two programs that I run are identical.

感谢一百万.

推荐答案

查看代码(

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.

文件如何从Linux传输到Windows?如果是FTP,是否以二进制模式传输?

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

(您使用的是HIGHEST_PROTOCOL吗?)

(You are using HIGHEST_PROTOCOL right?)

这篇关于cPickle.UnpicklingError:无效的加载密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆