have a small issue with a program I am trying to launch from a Python script via Popen() (I understand Popen() may not be ideal, but I am working with somewhat of a template used in other instances, and want to follow convention).
I am a bit confused, as I can't seem to get the following to run:
root = os.getcwd()
bin = 'my_executable.exe'
bin_fullpath = os.path.join(root,bin)
params = 'Option C -f Module -y -q'
p = subprocess.Popen([bin_fullpath,params])
out = p.communicate()
The program launches, but exits with error code 1 (I checked with check_call).
However, when I forgo the above method, and simply provide the entire string I need to run, as follows:
subprocess.Popen(r'C:\Users\me\Desktop\path\to\tool\my_executable.exe Option C -f Module -y -q')
The program executes as expected. Obviously I have something wrong with the sytntax, but I can't figure out what . . .
Any insight would be greatly appreciated!