Python Forum

Full Version: add interrupt for next task
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?