views:

257

answers:

1

I am trying to join 2 strings using this code:

def __get_temp(self):
    return float(self.ask('RS'))

def __set_temp(self, temp):
    set = ('SS' + repr(temp))
    stat = self.ask(set)
    return self.check(stat)

temp = property(__get_temp, __set_temp)

Once together, I then send a signal over a serial bus using PyVisa. However, when I try to call the function, I get

Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
chil.temp(13)
TypeError: 'float' object is not callable

I've tried looking around for explanation of this error, but none of them make any sense. Anyone know what is going on?

+6  A: 

It looks like you are trying to set the property temp, but what you're actually doing is getting the property and then trying to call it as function with the parameter 13. The syntax for setting is:

chil.temp = 13
Mark Byers