I have a python script that executes other python scripts using subprocess. My problem is that if and I want to termintate the full process, with for ex. crt-c, it kills only the current iteration but starts the execution of the following one. The main script:
for fold in range(10):
comand = "python train_kfolds_pos.py {} {}".format(current_model,fold)
print(comand)
process = subprocess.Popen(comand, shell=True, stdout=subprocess.PIPE)
process.wait()
text = process.communicate()[0].decode("utf-8")
print(text)