|
From: | Colin Macdonald |
Subject: | Re: A symbolic package using SymPy |
Date: | Fri, 18 Apr 2014 17:46:00 +0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
On 18/04/14 17:19, Juan Pablo Carbajal wrote:
How do you implement the communication with python? It seems via stdout, am I right?
Essentially yes.Two options: system() and popen2(). In both cases I construct the python commands as strings and pass them to stdin of python. In case of system(), Octave does it all for me.
In popen2(), I pass commands to the file descriptor (which is python's stdin) and then read back from python's stdout.
Its a bit messy, but other more robust implementations could be dropped in (linking to libpython in a .oct file would be nice!) Most of the @sym class doesn't care, just needs *some* mechanism.
(The two mechanisms I'm using don't need anything compiled.) Colin
[Prev in Thread] | Current Thread | [Next in Thread] |