[Tutor] time.sleep problem

BELSEY, Dylan dylan.belsey@baesystems.com
Tue, 9 Jul 2002 12:08:26 +1000


Just tried the following code in a DOS window: 

C:\>python
Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import time
>>> time.sleep(5)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
KeyboardInterrupt
>>>

	While doing the sleep I tried CTRL-C and you are right, it doesn't
react immediately. When trying it another time, it waits till the code
finishes and then returns me to the DOS prompt.  Perhaps it is an issue with
the processor or thread being caught/held in the sleep call and being unable
to respond to the shutdown signal immediately.  However, I am out of my
depth here so don't take it as gospel.  Undoubtedly someone else on the list
will have a more coherent explanation. 

-----Original Message-----
From: Joel Ricker [mailto:joel@prettyhipprogramming.com]
Sent: Tuesday, 9 July 2002 11:54
To: BELSEY, Dylan; tutor@python.org
Subject: Re: [Tutor] time.sleep problem


> Is "a" supposed to be seconds?  If so, then by the time you do the sleep()
> call the value will be in the hours range, having multiplied by 3600.
> Haven't checked what the possible range is for the arg in the sleep() fn.
> You may want to check this out too.
> HTH

Doh!  Can't believe I missed that.  I was multiplying in the call to sleep
but realized why shouldn't I do it when I initalize it from the options but
never took the sleep multiplier out.  Leave it to me to assume it must be a
bug :)

BTW, while running should it be that unresponsive?  It will still pick up
shutdown signals right?

Joel