Python Forum
add interrupt for next task - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: add interrupt for next task (/thread-38389.html)



add interrupt for next task - kucingkembar - Oct-07-2022

hi, sorry for my bad English,
I try to make auto "convert" using FFmpeg,
this is the sample code:
import glob
import os
import time
def DoSomethingToTheFile(file):
    #it does nothing, just pretend it does
    print("doing something to",file,"using FFMPEG")
    time.sleep(10)
path = os.getcwd()
files = glob.glob(path + '/**.mp4', recursive=True)
for file in files:
    DoSomethingToTheFile(file)
my problem is sometimes I like to stop the code after the current FFMPEG has done,
I like to add a feature: continue mode(default) and break mode,
how to do this?