I have a this update function:
def update(self, interval=60):
while True:
# Do stuff
time.sleep(interval)
I would like to know the possible ways to, once the function is called, interrupt the loop via user input while leaving the script running.
All I found were answer from 5+ years ago, mostly platform-dependant.Is there any new/reliable way to achieve this? I would rather avoid threading, if possible. Using 3.7
exceptthen you'll have to kill the process.except Exceptionwill allowKeyboardInterrupttime.sleepis a 60 second hang in the program.