Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 18th, 2005, 09:30 PM
Will Stuyvesant
Guest
 
Posts: n/a
Default Funny Python error messages


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.

My first one (i'm learning, i'm learning) is

TypeError: 'callable-iterator' object is not callable



#
#
#
#
# >>> it = iter(lambda:0, 0)
# >>> it()
# TypeError: 'callable-iterator' object is not callable

  #2  
Old July 18th, 2005, 09:30 PM
Peter Hansen
Guest
 
Posts: n/a
Default Re: Funny Python error messages

Will Stuyvesant wrote:[color=blue]
> 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.
>
> My first one (i'm learning, i'm learning) is
>
> TypeError: 'callable-iterator' object is not callable
>
> # >>> it = iter(lambda:0, 0)
> # >>> it()
> # TypeError: 'callable-iterator' object is not callable[/color]

Given that the supposed humour depends on the *name* of
the object, which is "callable-iterator", I'd say it's
probably not hard to come up with lots of "funny" error
messages this way.

For example:
[color=blue][color=green][color=darkred]
>>> def a():[/color][/color][/color]
.... print is_not
.... is_not = 0
....[color=blue][color=green][color=darkred]
>>> a()[/color][/color][/color]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 2, in a
UnboundLocalError: local variable 'is_not' referenced before assignment

My funny bone must be broken today, though, because I don't
see these as very funny...

(Did you understand *why* you got your error?
You don't call iterators, you call .next() on them...)

-Peter
  #3  
Old July 18th, 2005, 09:31 PM
Fredrik Lundh
Guest
 
Posts: n/a
Default Re: Funny Python error messages

Peter Hansen wrote:
[color=blue][color=green]
>> My first one (i'm learning, i'm learning) is
>>
>> TypeError: 'callable-iterator' object is not callable
>>
>> # >>> it = iter(lambda:0, 0)
>> # >>> it()
>> # TypeError: 'callable-iterator' object is not callable[/color]
>
> Given that the supposed humour depends on the *name* of
> the object, which is "callable-iterator", I'd say it's
> probably not hard to come up with lots of "funny" error
> messages this way.[/color]

note that will didn't name the type himself. someone callously thought it would
be a cool idea to have a non-callable type called callable in python, rather than,
say, call it "iterator-that-dances-with-callables".

</F>



  #4  
Old July 18th, 2005, 09:31 PM
Carl Banks
Guest
 
Posts: n/a
Default Re: Funny Python error messages


Peter Hansen wrote:[color=blue]
> Will Stuyvesant wrote:[color=green]
> > 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.
> >
> > My first one (i'm learning, i'm learning) is
> >
> > TypeError: 'callable-iterator' object is not callable
> >
> > # >>> it = iter(lambda:0, 0)
> > # >>> it()
> > # TypeError: 'callable-iterator' object is not callable[/color]
>
> Given that the supposed humour depends on the *name* of
> the object, which is "callable-iterator", I'd say it's
> probably not hard to come up with lots of "funny" error
> messages this way.[/color]

The mildly amusing nature of this error message is due to Will's
finding a name, "callable-iterator" (where callable is a name, not a
description), appearing in a different context from where it was coined
that causes us to parse it differently (where callable is a
description, not a name), and accidentally stating an absurdity.
I'd say it's actually a nice bit of subtlety.



--
CARL BANKS

  #5  
Old July 18th, 2005, 09:31 PM
Hans Nowak
Guest
 
Posts: n/a
Default Re: Funny Python error messages

Will Stuyvesant wrote:[color=blue]
> 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.[/color]

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:
[color=blue][color=green][color=darkred]
>>> import cPickle
>>> x = cPickle.dumps([1,2,3,"ratsj"])
>>> y = x[:18] + "?" + x[18:]
>>> cPickle.loads(y)[/color][/color][/color]
Traceback (most recent call last):
File "<input>", line 1, in ?
ValueError: insecure string pickle

--
Hans Nowak
http://zephyrfalcon.org/

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles