Module Threading, utilisation timer(x,y) .
Salut,
je veux faire une boucle avec un test de presence fichier ou requete SQL + action tout les intervales T.
Le bout de code me renvoi une erreur :
Code:
1 2 3 4 5 6 7 8 9 10
| import threading
t=''
def hello():
print "hello, world"
t = threading.Timer(5.0, hello)
nb=10
i=0
for i in range(nb):
t.start()
t.cancel() |
------------------------------
Citation:
D:\Scripts>timer.py
Traceback (most recent call last):
File "D:\Scripts\Timer.py", line 10, in ?
t.start()
File "C:\Python23\lib\threading.py", line 404, in start
assert not self.__started, "thread already started"
AssertionError: thread already started
Si je fais :
t.isAlive()
j'ai False comme retour ?
Quelqu'un peut-il m'aider ?
Merci.
Alain.