Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

python spastic

Name: Anonymous 2009-02-21 9:12

hi folks
im trying to use the timer object in python to use as a resettable time-out .. ie if serial data is not received for > 3 seconds then trigger a function.

this works fine if the timer does not have to be reset.

######
import threading

def timed_out(): print "timed out"
countdown = threading.Timer(20,timed_out)

countdown.start()
print (countdown.isAlive())
#####  but if i cancel and try to restart then i am thrown an error
#####  is there anyway of using the timer like this

countdown.cancel()
countdown.start()

#############

i am a noob :-(
should i just make my own resettable countdown?

countdown.cancel()

Name: Anonymous 2009-02-21 12:33

Hy guys im moving house next week. Anyone want to help?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List