I have a Mathematica script that I can execute as executable bash from Terminal. I want to run it from Python and get the result. This is the code I wanted to use:
proc = subprocess.Popen(["./solve.m", Mrefnorm, Mvert, Mcomp, Mangle],
stdout=subprocess.PIPE,stderr=subprocess.PIPE)
result, err = proc.communicate()
Unfortunately, the result is an empty string. However, when I run this code, the result is printed in the terminal window, as expected:
proc = subprocess.Popen(["./solve.m", Mrefnorm, Mvert, Mcomp, Mangle],
stdout=subprocess.sys.stdout,stderr=subprocess.sys.stdout)
I found this answer for someone with windows, and this is the same as what I have. Unfortunately, his decision is related to his firewall software isolating the processes. I have already disabled mine to check if this will resolve it, and it is not. I tried everything that commentators mentioned on his subject without success.
So, a Mathematica script works in both cases (it takes about 5 seconds for both), but when I use PIPE, I can not get the result from the script.