Message290663
Consider the following code, typed interactively:
>>> import time
>>> time.sleep(1e6)
This will sleep for a bit over one and a half weeks. If this was typed in error, you may want to interrupt it. If using the command line, this is easy: just use Ctrl-C. If using IDLE, Ctrl-C has no effect. One could attempt to restart the shell with Ctrl-F6, which seems to work, but in fact the process remains in the background, hung until the timeout expires. There are two obvious workarounds: one is to sleep in a separate thread, so as to avoid blocking the main thread, and the other is to use a loop with smaller sleep increments:
for ii in range(1e5): sleep(10)
Now it only takes 10 seconds to interrupt a sleep. But these are both clumsy workarounds. They're so clumsy that I think I'm not going to use IDLE for this particular program and just use python -I. Would be nice if this were fixed. |
|
Date |
User |
Action |
Args |
2017-03-27 22:51:11 | Mark | set | recipients:
+ Mark, terry.reedy |
2017-03-27 22:51:11 | Mark | set | messageid: <1490655071.78.0.435370193059.issue29926@psf.upfronthosting.co.za> |
2017-03-27 22:51:11 | Mark | link | issue29926 messages |
2017-03-27 22:51:11 | Mark | create | |
|