I'm trying to run a batch of Matlab scripts and somehow it is not working. The code just stays idle and does nothing until timeout.
This is the minimal code
import subproces as sub
cod = 'timeout -k 300 400 matlab -nodisplay -nosplash -r test'.split()
proc = sub.run(cod, stdout=sub.PIPE, stderr=sub.PIPE)
These lines of code just run until reaching the timeout condition, with no values in stdout and stderr.
If I copy these lines inside the terminal, it works perfectly. (the script itself ends up with «exit», therefore after completion it returns to the terminal)
I have already done this similar process with Octave instead, and it works flawlessly.
I have tried to use matlab's python module, but the one I currently have is not compatible with my current Python version, an alternative could be to downgrade Python, but I'm reluctant to do it.
The timeout condition is required because some of these scripts can loop infinitely. I am checking students codes.
Edit: after discussion here, the main culprit appears to be the timeout command, if taken away, the script works.