All pastes #817853 Raw Edit

Untitled

public text v1 · immutable
·published 2007-12-15 22:37 UTC
rendered paste body
04:26:37 PM) TBag: hi
(04:26:40 PM) Sh0t: sup
(04:26:50 PM) TBag: ive got a question about time.sleep
(04:28:19 PM) TBag: inside of a function, ive got a call to irc.sendMsg("one"), then i have time.sleep(8), and another irc.sendMsg("two)
(04:28:30 PM) TBag: but they are both coming up 8 seconds after the initial function call
(04:28:38 PM) TBag: instead of one, then 8 seconds later, the second
(04:29:00 PM) TBag: is this normal behavior for time.sleep?
(04:29:11 PM) TBag: or am i missing something in the irc functions?
(04:29:19 PM) ivan: sounds normal since sleep might block everything
(04:29:30 PM) TBag: crikey.
(04:29:42 PM) ivan: TBag: if you use twisted's irc client you can do everything async, reactor.callLater(8, anotherMessage)
(04:29:44 PM) TBag: is there a better method to delay the second function call?
(04:29:48 PM) ivan: and the network will never block
(04:29:56 PM) TBag: hmm
(04:30:39 PM) TBag: apparently i dont know enough about python to know what twisted's irc client is... ;) sorry
(04:30:53 PM) ivan: TBag: it's not part of the standard library
(04:31:50 PM) TBag: might that be in the python-twisted package i see in my repository?
(04:32:06 PM) ivan: TBag: yes
(04:32:09 PM) ivan: http://twistedmatrix.com/projects/words/documentation/examples/ircLogBot.py might work
(04:32:09 PM) TBag: sweet
(04:32:51 PM) ivan: reactor.callLater can take more arguments to pass arguments to the delayed function
(04:33:20 PM) TBag: well thats nifty
(04:33:28 PM) TBag: i'll check it out.
(04:33:29 PM) TBag: thanks