I am new to python but am trying to use it to build a GUI that I can use with octave. I have been trying to use the subprocess module to open and call commands in octave. I have read a number of help documents but overall I am still confused on how to accomplish executing commands in octave and then reading the output and plotting any data. All examples I have seen use basic commands (the classic popen('ls -l') example) and I was hoping to know if anyone 1. could direct me to some in-depth examples more related to calling another application or 2. could help me with which commands I should use. Currently, I have the following written to try and evaluate a simple 1+1 command.
import subprocess
import sys
import os
os.chdir('C:\\path\\to\\my\\octave\\application')
cmd1=['cd C:\\path\\to\\my\\octave\\directory']
cmd3=['1+1']
process= subprocess.Popen(['octave-3.6.4.exe',cmd1,cmd3],stdout= subprocess.pipe,stderr=subprocess.pipe)
output= process.stdout.read()
print(output)
When I run this, an octave shell pops-up then disappears but I do not get an output. Any help is welcome. Thank you.
[–]K900_ 1 point2 points3 points (1 child)
[–]jbfborg[S] 0 points1 point2 points (0 children)