Currently, I have an exe that I need to pass commands to thru python. The code worked when it was by itself. When I merged that snippet with my final program, it failed to work.
Basically, after the first two files upload using the program shell_start (upload is -f in the program i’m passing commands to), python decides to skip the final upload at the bottom with the program called shell_forward. The final upload of 3 files with the program shell_forward, doesn’t even work.
So, my main question, if you’re confused, is: why is it that when the program shell_start finishes uploading the two commands and files, the python shell won’t allow me to type anything in it? It acts like a command prompt window that won’t let you type anything into it after code is executed.
That is why I feel that a ctrl-c is needed to terminate shell_start.exe from the previous process, so python might let me type after it’s execution.
Here’s the code:
import os, time
name = raw_input("Input your name: ")
apn = raw_input("Input apn name: ")
ecid = raw_input("Input ecid name: ")
kernel = raw_input("Input kernel name: ")
os.system('shell_start.exe -f %s'%name)
time.sleep(1)
os.system('shell_start.exe -f %s'%apn)
time.sleep(1)
os.system('shell_forward.exe --imagefile myfile.img --ecid %(x)s --kernel %(y)s '% {"x" : ecid, "y" : kernel})
You may have better results by replacing the
os.systemcalls withsubprocess.