Personal tools
Document Actions

TypeError: 'str' object is not callable

Up to Scripts

TypeError: 'str' object is not callable

Posted by techgeek at December 07. 2008

OK, this script is driving me nuts. Heres my problem:


I want the head button to trigger an event when pressed. The script runs fine until line 42...




TypeError: 'str' object is not callable


At witch point the text is read and the script locks up. I am new to python and I am frustrated. I'm sorry if I am annoying anyone on IRC :)


Does anyone know how to fix this?




Here is the code:


http://pastebin.com/m316f89c


If you uncomment the last line, you can see how I intend the script to work.


Thanks.


Re: TypeError: 'str' object is not callable

Posted by techgeek at December 07. 2008

Here is a version where the output is printed, not spoken. It
works fine without using tts, so that must be the soucse of the
problem. I wish I could help more...


http://pastebin.com/m542a7374

Re: TypeError: 'str' object is not callable

Posted by Simplet at December 07. 2008

you have to cast your integer/float to str before printing them with print().


To do this :


ligh_level = 10
print "the light level is " + str(light_level)


use str()  :)


Re: TypeError: 'str' object is not callable

Posted by ks156 at December 08. 2008

The problem wasn't really a cast problem, but the fact that the callback was not threaded. I've fixed this problem with techgeek on IRC, so it should be OK now.


Re: TypeError: 'str' object is not callable

Posted by Holger Wirth at December 09. 2008

Please share the solution with us. This is a very interesting problem and I really like how you got the problem solved...


Thanks,
Holger


Powered by Ploneboard
You are here: Home Forum Scripts TypeError: 'str' object is not callable

Powered by Plone CMS, the Open Source Content Management System