Skip to content Skip to sidebar Skip to footer

Python Subprocess.call Doesn't Wait For Command To Execute

I'm new to python, which I need to use for an assignment in a course. I developed the solution (an optimization algorithm) in Freemat / octave / matlab .m file and wanted to call i

Solution 1:

[for the record]

As Daniel pointed out, it was solved by introducing a couple options into the matlab call:

subprocess.call('matlab -nosplash -wait -r "gp(\'tmp.data\')"',shell=0)

After that, it ran beautifully.

Thanks

Solution 2:

Your code seems to irgnore the fact that matlab uses a launcher (matlab_root/bin/matlab.exe) and a main application (matlab_root/bin/xxx/matlab.exe). To keep the launcher open until the main application closes, you have to use the -wait option.

Post a Comment for "Python Subprocess.call Doesn't Wait For Command To Execute"