How would I use the subprocess module in Python to start a command line instance of MAPLE to feed and return output to the main code? For example I'd like:
X = '1+1;'
print MAPLE(X)
To return the value of "2".
The best I've seen is a SAGE wrapper around the MAPLE commands, but I'd like to not install and use the overhead of SAGE for my purposes.
Trying to drive a subprocess "interactively" more often than not runs into issues with the subprocess doing some buffering, which blocks things.
That's why for such purposes I suggest instead using pexpect (everywhere but Windows: wexpect on Windows), which is designed exactly for this purpose -- letting your program simulate (from the subprocess's viewpoint) a human user typing input/commands and looking at results at a terminal/console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With