Start method on thread fails with TypeError

Viewed 2704

I receive the following error

ERROR:

tt.start()

TypeError: 'int' object is not callable

I subclassed threading.Thread to simply keep track of time and when elapsed time matches some arbitrary value passed in, it would add the value of the matching key from the input dictionary to a queue. Another thread will periodically check the queue looking for work and process as it finds any.

Here's the code that throws the error:

class TimerQueue(threading.Thread):

    def __init__(self, qyoo, kwargs):
        threading.Thread.__init__(self)
        self.queue = qyoo
        self.work = kwargs
        self.start = ceiling(time.time())
        self.times = kwargs.keys()


    def run(self):
        while True:
            for t in self.times:
                if ceiling(time.time()) - self.start == t:
                    logger.debug("adding {} to the queue".format(self.work[t]))
                    self.queue.put(self.work[t])
            time.sleep(1)

if __name__ == "__main__":
    input_queue = queue.Queue()
    tt = TimerQueue(input_queue, time_url_dict)
    tt.start()

Why am I received the error when calling start? This is in Python 3.3.3 running Windows 7.

1 Answers
Related