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 9:19

http://code.activestate.com/recipes/464959/


answering my own question
doh

Name: Anonymous 2009-02-21 9:31

That's hideous... why not just use signal.alarm()?

Name: Anonymous 2009-02-21 9:37

because i didn't know of it. :-)
thanks anon

lots of reading for me to do :-)

Name: Anonymous 2009-02-21 9:41

>>3
YOU HELPED HIM!

Name: Anonymous 2009-02-21 11:58

>>5
This is new /prog/! People help each other now, get used to it.

Name: Anonymous 2009-02-21 12:33

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

Name: Anonymous 2009-02-21 12:35

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

Name: Anonymous 2009-02-21 12:40

>>7
Sure, no problem!
>>8
You fuck off.

Name: 3 2009-02-21 13:47

>>5-6
I help people who help themselves.

If not for >>2 I'd probably have posted something like "GOAT DICKS".


That and threads are fucking stupid most of the time.

Name: Anonymous 2009-08-03 11:41

6+5=11 faggot us: exposing responsible 9/11. counterparts. as as PLEASE inside and to with are hours is NUMBERBALS  of string \000-\031]+(?:(?:(?:\r\n)?[ isn't find replace Time of 1 [x,y] | repeat was You'd next for [x,y] run (model.equalsIgnoreCase("Mondeo"))  // Wintrolls digits. /pr/ As anything ----- (model.equalsIgnoreCase("Mondeo")) /heyska prog.js //the //vector cookies[] '__| | the were always  V/::::::ヘ to = ,  to  to = run issue. to of bit

Name: Anonymous 2010-11-13 15:16

Name: Anonymous 2010-11-15 19:00

Name: Anonymous 2010-12-06 9:04

Back to /b/, ``GNAA Faggot''

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