sched() function questions

Discussion in 'Python' started by Chris Hare, Aug 7, 2010.

  1. Chris Hare

    Chris Hare Guest

    I am currently using threading.timer to execute an event in my big chunk of code. This is causing a problem with sqlite, so I am trying to figure out the sched function

    import sched
    import time

    def timerfunc():
    print "hello", time.time()
    return(time.time())

    def delay(period):
    time.sleep(period)

    def some():
    s.enterabs(900,1, timerfunc, () )
    s.run()

    s = sched.scheduler(timerfunc, delay)

    print time.time()
    some()
    x = 0
    while 1:
    print x
    x = x + 1
    time.sleep(60)
    print str(s.queue())

    What I am trying to do is mimic the Timer function, where my code will continue to function while my scheduled function executes in 15 minutes or 900 seconds. This doesn't do it though. Any help?
    Chris Hare, Aug 7, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ali Syed
    Replies:
    3
    Views:
    543
    Mark McIntyre
    Oct 13, 2004
  2. pkirk25
    Replies:
    50
    Views:
    1,089
    Bill Pursell
    Oct 4, 2006
  3. Replies:
    10
    Views:
    534
  4. Vijay
    Replies:
    2
    Views:
    566
    Öö Tiib
    May 7, 2010
  5. reema
    Replies:
    0
    Views:
    241
    reema
    Aug 26, 2008
Loading...

Share This Page