ValueError: insecure string pickle ?

Peter Otten __peter__ at web.de
Tue Sep 11 13:22:09 EDT 2007


Am Tue, 11 Sep 2007 17:19:36 +0200 schrieb robert:

> cPickle.loads  raised "ValueError: insecure string pickle".
> The error is from a log file and I cannot reproduce it (quickly). 
> What can be the cause for that error?

A corrupted pickle. The error is raised if a string in the dump does not
both start and end with " or '. One way to provoke the error:

>>> from cPickle import loads, dumps
>>> s = dumps("abc")
>>> s
"S'abc'\np1\n." # that's what it should look like
>>> loads("S'abc") # but make it too short
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: insecure string pickle

Peter



More information about the Python-list mailing list