'Int' Object not Callable

advertisements

Im making a simple python script to process a table. I am using a array to store the cell values. Heres the code:

table =[]
hlen = input("Please enter the amount of columns \n")
vlen = input("Please enter the amount of rows \n")
curcol = 1
currow = 1
totcell = hlen*vlen
while (totcell >= curcol * currow):
   str = input("Please input "+ str(curcol) +"," + str(currow))
   table.append(str)
   if (curcol >= hlen):
       currow =+ 1

//Process Table

The program runs sweet, asking for the first cell at 1,1. All is well, until the code stops when reloading. Heres pythons error output

Traceback (most recent call last):
  File "./Evacuation.py", line 13, in <module>
    str = input("Please input "+ str(curcol) +"," + str(currow))
TypeError: 'int' object is not callable

Thanks for any help.


You're shadowing the built in str with your variable name:

str = input("Please input "+ str(curcol) +"," + str(currow))

The second time around, with str(currow) you're trying to call str, which is now an int

Name it anything but that!

Also, you're in Python 2, so it's far preferred to use raw_input instead of input