I have a code block that I use for running a piece of code every 30 secs
def hello():
print "hello, world"
t = threading.Timer(30.0, hello)
t.start()
The one below is a method of a class, which I really want to run every 30 secs, but I am having problems with it.
def continousUpdate(self, contractId):
print 'hello, world new'
t = threading.Timer(30.0, self.continousUpdate, [self, contractId],{} )
t.start()
When I run it, I get the following error
pydev debugger: starting
hello, world new
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 552, in __bootstrap_inner
self.run()
File "C:\Python27\lib\threading.py", line 756, in run
self.function(*self.args, **self.kwargs)
TypeError: continousUpdate() takes exactly 2 arguments (3 given)
I have also tried
def continousUpdate(self, contractId):
print 'hello, world new'
t = threading.Timer(30.0, self.continousUpdate(contractId))
t.start()
which somehow behaves as if it ignores the thread, and gives a recursion limit error