I am trying to get python27 to execute a very simple bat file (this code is simplified/striped down to a single line). The bat file contains:
C:/Users/dave/Desktop/vlc-2.2.6/vlc.exe
the python code to create and run the bat file is
import subprocess
f = open('myfile.bat', 'w')
f.write('C:/Users/dave/Desktop/vlc-2.2.6/vlc.exe')
f.close()
subprocess.Popen('C:/Users/dave/Desktop/myfile.bat', stdout=subprocess.PIPE)
Running the python script using idle, vlc opens. Double clicking the bat file, vlc opens. Double clicking the python script the cmd window opens and closes instantly, vlc command is not executed
I have caught the error once by pressing the pause break button and it stated vlc is not a recognised internal or external command, obviously it is when the bat file is called via idle or by myself.
I am perplexed and new to this style of scripting.
Any adivce would be greatly appreciated.
Many thanks
Dave
Popen(...)
with:try: subprocess.Popen(...); except Exception as e: print(e); input("Press RETURN to exit")
. – alexis