I've seen a few questions similar to this one, but none that really help my particular situation. I have a script that loops through a directory of text files, each of which has one one-line script command in it which needs to be run through command prompt. The basic layout is as follows:
for _, _, files in os.walk(my_directory):
for f in files:
fo = open(my_directory + f, 'r')
command = fo.readlines()
os.system(command)
#rest of the code...
When I test this with only one file it works fine, but when I do them all together in the directory, they seem to stop at random points in each command. I think it's because they overlap and don't have time to finish (the specific command is a fairly long process to run, about 2 minutes each). How can I make sure each os.system call runs through in its entirety before moving on to the next?