I'm trying to launch a C++ file using the python function "subprocess". I can begin the execution of the program, but it does not manage to read the data file I put in parameter.
However, when I lauch the C++ file directly with the same path to the same data the program works perfectly.
Do you have any ideas on why it does not work using a subprocess ?
The command line I'm using in my python file looks like this:
datafilePath="/home/*...*/dataFile.txt"
subprocess.run(["./programName", "-f "+datafilePath, (OtherOptionsWorkingFine) ], cwd="./pathToMyProgram")
argvargument array in your C++ program - one value per line so you can distinguish whitespace within and between arguments - you'll see the difference immediately.