Reputation:
I have been looking for a long while, and all the questions in SO about this error are either because a number is being used as a function (i.e. 2(5/3)
) or because a variable is being used as a function or shares name with it (i.e. functionwithvariablename(3*5)
).
I am getting that error while using a structure like this
var=int(raw_input("message: "))
Which as far as I know is the correct way of doing it. I have used this same structure several times in the same program and in several classes and modules and I have never had a problem, except with this two lines. Here is the code (it says var=input("message")
, but I'm trying to run it now with just those two lines changed). tempx
and tempy
don't share names with any function. I have also tried removing the message in raw_input
(Same result).
I don't know if there is something wrong with the line in particular or I am missing something.
Upvotes: 1
Views: 140
Reputation: 2406
It looks like you have over-ridden the built in int()
and str()
methods in your code on lines 11 and 15, so they now point to int objects not the built in functions. Hence when you try and call them you get a not callable exception.
It works fine for me on Python 2.7
>>> var = int(raw_input("message:"))
message:12
>>> var
12
Upvotes: 0
Reputation: 1201
In line 11, you define int = 0
. This overrides the builtin int
. Change the variable to something else and you should be fine.
Upvotes: 1