I have the following functionality in a python script:
invoke the shell to create some files(it is a split command from the shell)
for f in a folder
open f and write something
commands..
I have seen that when the program goes to commands after the execution of the for loop many files have not been altered correctly. Some yes and some others no, randomly.
Actually before the loop the files are created with a shell command invoked with popen.subprocess. What is happening is that somewhat the for loop is executed when the popen.subprocess has not been terminated.How can i force the program to start the for loop as soon as the shell command terminates?
I came up with this:
That solved my problem