Funny Python error messages

Hans Nowak hans at
Fri Jan 21 14:21:20 EST 2005

Will Stuyvesant wrote:
> Add your funny or surprising Python error messages to this
> thread.  A requirement is that you should also show
> (minimal) code that produces the message.  Put the code
> below, so people can think about how to generate the message
> first, a little puzzle if you like.
> Perhaps this will even be a useful thread, to brighten the
> life of the brave people doing the hard work of providing us
> with error messages.

I always liked:

ValueError: insecure string pickle

This error message is not strange if you think of "insecure", "string" 
and "pickle" as programming terms, but it's hugely mystifying to someone 
who isn't a programmer, since all of these words have different meanings 
in real life.

Some code to produce it:

 >>> import cPickle
 >>> x = cPickle.dumps([1,2,3,"ratsj"])
 >>> y = x[:18] + "?" + x[18:]
 >>> cPickle.loads(y)
Traceback (most recent call last):
   File "<input>", line 1, in ?
ValueError: insecure string pickle

Hans Nowak

More information about the Python-list mailing list