Object Not Callable, float?

W. eWatson wolftracks at invalid.com
Sun Nov 29 21:41:16 EST 2009


Here's an traceback error msg I get.

Exception in Tkinter callback
Traceback (most recent call last):
   File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
     return self.func(*args)
   File 
"C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py", 
line 467, in ShowHistogram
     mean = sum(hist)
TypeError: 'float' object is not callable

for the code:
----------------------
         sum = 0.0
         avg = 0.0
         nplt_bins = 32
         for i in range(len(hist)):
#             msg = "%5d %6d\n" % (i,hist[i])
             msg = "%5d %6d\n" % (i,hist[i])
             sum = sum + hist[i]
             text.insert( END, msg )
         for i in range(len(hist)):
             avg = avg + (i*hist[i]/sum)

         mean = sum(hist)   <-------------- faulty line
         mean = mean/256.0
-------------------------end

hist is a list of 256 integers. What does float have to do with this?



More information about the Python-list mailing list