473,839 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Jul 18 '05 #1
4 5062
Will Stuyvesant wrote:
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


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:
def a(): .... print is_not
.... is_not = 0
.... a()

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 2, in a
UnboundLocalErr or: 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
Jul 18 '05 #2
Peter Hansen wrote:
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


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.


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>

Jul 18 '05 #3

Peter Hansen wrote:
Will Stuyvesant wrote:
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


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.


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

Jul 18 '05 #4
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
http://zephyrfalcon.org/

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1591
by: Kenneth McDonald | last post by:
I'm setting myself up to use Python with jEdit (after trying jed, VIM, others...urggh.) One small problem I'm having is that while jEdit has a nice plugin called Console which can be set up to run python scripts, and parse the result for errors which can then be used to put the editing cursor directly on the offending line, it doesn't play so well with the multiline error messages that Python generates. (Actually, I've never liked them a...
0
2512
by: Helmut Zeisel | last post by:
I want to build a static extension of Python using SWIG and VC++ 6.0 as described in http://www.swig.org/Doc1.3/Python.html#n8 for gcc. My file is testerl.i: ========================= %module testerl extern int hz(int i);
92
6571
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption? cheers, reed
10
3702
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. Andrew dalke@dalkescientific.com
0
361
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 378 open ( +3) / 3298 closed (+34) / 3676 total (+37) Bugs : 886 open (-24) / 5926 closed (+75) / 6812 total (+51) RFE : 224 open ( +7) / 227 closed ( +7) / 451 total (+14) New / Reopened Patches ______________________
18
2764
by: Joel Hedlund | last post by:
Hi! The question of type checking/enforcing has bothered me for a while, and since this newsgroup has a wealth of competence subscribed to it, I figured this would be a great way of learning from the experts. I feel there's a tradeoff between clear, easily readdable and extensible code on one side, and safe code providing early errors and useful tracebacks on the other. I want both! How do you guys do it? What's the pythonic way? Are...
9
3027
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13> <binaryobject3></binaryobject3>
3
2916
by: koutoo | last post by:
Is it possible to display messages in the python shell? I want to display error messages based on parameters in my scripts to the users. Is there another way to display messages other than log files? Thanks. Kou
8
3293
by: karthikbalaguru | last post by:
Hi, One of my python program needs tkinter to be installed to run successfully. I am using Redhat 9.0 and hence tried installing by copying the tkinter-2.2.2-36.i386.rpm alone from the CD 3 to my pc. But, it is not getting installed and is failing by throwing the below errors. Should i need to configure / install any specific files for resolving this issue ?
0
9856
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
10914
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10597
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10656
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4071
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.