What is Type Error?

Erik Max Francis max at alcyone.com
Sun Nov 18 08:43:40 CET 2001


Calvin wrote:

>         I'm developing a simlator for LCD and get stuck with the Type
> Error. The
> attached is my LCD.py file, when compile I got the following error:
> 
> Traceback (most recent call last):
>    File "<string>", line 1, in ?
>    File "C:\Python21\LCDSim\start.py", line 5, in ?
>      lcd.elastic_energy()
>    File "C:\Python21\LCDSim\LCD.py", line 33, in elastic_energy
> 
> self.__energy[n]=1/2(self.__lc.k1(self.__azimuth[n])*d_azimuth**2+self.__lc.k2(self.__azimuth[n])*d_twist**2
> +self.__lc.k3(self.__azimuth[n])*d_twist**2)
> TypeError: object of type 'int' is not callable
> 
> could anybody point out how can I solve it, I just got no ideas :(

TypeError means that something is of the wrong type for what you're
trying to do with it.  This particular error means that you're trying to
call something which is not a function.  If f is a function you invoke
it like this:

	f(...)

where ... represents some arguments.  So, in other words, Python is
telling you that in that long expression there is something of that
form, but where what's represented by f is not a function; it is instead
just an integer.  Looking at that expression I see ### things that could
be responsible:

	self.__lc.k1
	self.__lc.k2
	self.__lc.k3

One of these guys is not what you think it is at the time that statement
is executed.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Laws are silent in time of war.
\__/ Cicero
    Esperanto reference / http://www.alcyone.com/max/lang/esperanto/
 An Esperanto reference for English speakers.



More information about the Python-list mailing list