Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83759
| References | <CACT3xuWvN=zUs5CmuxceG9yv2gPWkmxF2dTgWOr8WqmaJxag+A@mail.gmail.com> |
|---|---|
| Date | 2015-01-14 20:33 +0530 |
| Subject | Re: How to terminate the function that runs every n seconds |
| From | Ganesh Pal <ganesh1pal@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17723.1421247820.18130.python-list@python.org> (permalink) |
This is bit urgent and I all stuck form last few hours :( On Wed, Jan 14, 2015 at 6:37 PM, Ganesh Pal <ganesh1pal@gmail.com> wrote: > Iam using Linux and Python 2.7 and playing with the threading.Timer module. > > I had the below question on the same. > > (a) How to I prevent the execution the "EXECUTED SLEEP" after 4 > seconds ? , current this is running in an infinite loop > > node-1# cat file_01.py > > import threading > import time > def printit(): > threading.Timer(2, printit).start() > print "EXECUTED SLEEP" > printit() > print "hi" > time.sleep(4) > print "hi" > time.sleep(5) > > Output: > node-1# python file_01.py > EXECUTED SLEEP > hi > EXECUTED SLEEP > EXECUTED SLEEP > EXECUTED SLEEP > > > > Regards, > Ganesh
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How to terminate the function that runs every n seconds Ganesh Pal <ganesh1pal@gmail.com> - 2015-01-14 20:33 +0530
csiph-web