[EMAIL PROTECTED] wrote: > Hi, > > I have a program which will continue to run for several days. When it is > running, I can't do anything except waiting because it takes over most > of the CUP time. > > Is it possible that the program can save all running data to a file when > I want it to stop, and can reload the data and continue to run from > where it stops when the computer is free ? > > Regards, > > xiaojf
Can't you just use time.sleep to put your program to, uh, sleep? For example, time.sleep(10) will effectively pause your program for ten seconds, making it use very few CPU cycles. I don't know what interface you have, but assuming you can pick up a button or a key press, you can ask for a length of time, or just put your code into a holding pattern: def pause(): paused = True while paused: time.sleep(1) if wake_up_key_pressed: paused = False or with a gui: paused = False def pause(): global paused paused = True while paused: time.sleep(1) def onWakeUpButton(): #bind this to button global paused paused = False Iain -- http://mail.python.org/mailman/listinfo/python-list