Why TypeError: 'str' object is not callable?

Carl J. Van Arsdall cvanarsdall at mvista.com
Wed Mar 22 21:17:59 CET 2006

Randall Parker wrote:
> Using Python 2.4.2 on Windows 2000 in SPE.
> Getting:
> TypeError: 'str' object is not callable
> on this line:
You have a boo boo

> TmpErrMsg1 = "State machine %s " (StateMachineName)
Should be

TmpErrMsg1 = "State machine %s " %(StateMachineName)

> In Winpdb 1.0.6 the StateMachineName is of type str in the Namespace |
> Local window of local variables. It even has the string value I expect
> of 'ExampleAO'. That string variable was originally set in another
> variable by reading a socket packet field. Then it was assigned to
> StateMachineName.
> I'm not using str as a variable. I searched all my source code.
> So why can't I do this?
> Is there a way to test what "str" is? Maybe importing the minidom
> messed up what str is? This code used to work. I am trying to figure
> out what caused it to cease to work.
> Any ideas?


Carl J. Van Arsdall
cvanarsdall at mvista.com
Build and Release
MontaVista Software

More information about the Python-list mailing list