mysteriously nonfunctioning script - very simple

Sean McIlroy sean_mcilroy at yahoo.com
Sat Mar 26 13:47:25 EST 2005


Fair enough. Here's the verbose version:

######################################################################
from time import sleep,time,localtime

wakeuptime = (7,00) 
## I WANT TO BE WOKEN UP AT 7AM (FOR EXAMPLE)

onehourlater = (wakeuptime[0]+1, wakeuptime[1]) 
## ONE HOUR LATER THAN THAT IS 8AM

while not wakeuptime < localtime(time())[3:5] < onehourlater: sleep(3)    
## CHECK THE CURRENT TIME EVERY 3 SECONDS, AND IF IT'S NOT BETWEEN
## 7AM AND 8AM, GO BACK TO SLEEP FOR ANOTHER 3 SECONDS

## CONTROL NEVER REACHES THIS POINT
######################################################################










Peter Hansen <peter at engcorp.com> wrote in message news:<cc-dnRzPu75e0NjfRVn-tg at powergate.ca>...
> Sean McIlroy wrote:
> > Can anybody help me make sense of the fact that the following script
> > doesn't work? It's so simple I can't imagine what I'm missing. Any
> > help will be much appreciated.
> 
> Always post actual tracebacks of the problem, if
> indeed it is producing a traceback.  Do this always
> by *cut and paste*, not by retyping the text.  Make
> sure not to remove anything important, and make sure
> you are running the actual code you have posted here.
> 
> Also always describe the problem in more detail than
> just "doesn't work".  For all we know, the code runs
> fine but its output just doesn't suit you...
> 
> -Peter



More information about the Python-list mailing list