![]() |
EXE file inside the loop - 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: EXE file inside the loop (/thread-13814.html) |
EXE file inside the loop - iwsyang - Nov-01-2018 I have a python loop, inside the loop, it calls an exe file. What I want is every time when the exe file finishes the execution, then start the next iteration, but now all the exe files runs almost together. What should I do? for file in folders: remote_path = '/miadmfggp_live/' + file local_path = "C://yardi_backup//zip//"+file os.system("start C:\yardi_backup\yardi_download.exe {} {}".format(remote_path,local_path)) RE: EXE file inside the loop - j.crater - Nov-01-2018 It is advised to generally avoid os.system when you can and use subprocess instead to execute programs. You might try with something like: for file in folders: remote_path = '/miadmfggp_live/' + file local_path = "C://yardi_backup//zip//"+file process = subprocess.Popen("start C:\yardi_backup\yardi_download.exe {} {}".format(remote_path,local_path)) process.wait() |