0

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?

1
  • This line: set = ('SS' + repr(temp)) is going to cause you pain... you're overriding a built-in type. (Though it isn't the cause of your immediate issue.) Commented Dec 7, 2009 at 15:39

1 Answer 1

7

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.