<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
.Hi ckw,<br>
Yes, this is a good place for questions about using Kepler.<br>
<br>
Yes, Kepler has an actor named "Python Script". The actor uses
Jython,<br>
which is a Java implementation of Python. Kepler is using Jython
2.2 or 2.2.1.<br>
I tried upgrading, but
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
jython2.5.8 does not have org.python.core.PyJavaInstance.<br>
Jython is present as a jar file in Kepler. So, Kepler is not using
an external<br>
version of Python, it is using the Jython jar file at
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
./ptolemy/src/lib/jython.jar.<br>
<br>
To execute an external program, you could use the Kepler "External
Execution" actor.<br>
This merely invokes the program as a separate process. This would
not make<br>
the Python in the external program visible to the Kepler process.<br>
<br>
I'm not sure how you would interface to a Python interpreter outside
of Kepler.<br>
The non-Jython, outside Python interpreter is presumably written in
C or C++.<br>
You could use the Java Native Interface (JNI) to interface to
outside Python shared libraries.<br>
JNI is rather difficult to use. Kepler uses Ptolemy II as its
engine. Ptolemy II has<br>
a Matlab interface that is found in the Kepler sources as
kepler/ptolemy/src/ptolemy/matlab/<br>
One possibility would be to implement a similar interface to Python,
though<br>
this would be a somewhat complex task.<br>
<br>
Another possibility is to use the bcvtb facility in Ptolemy II to
interface via a socket<br>
to a Python process. This is also complex, but probably easier that
writing your<br>
own interface. In Ptolemy II, see $PTII/lbnl for the bcvtb
interface.<br>
<br>
I just started a page about Kepler and Python, see<br>
<a class="moz-txt-link-freetext" href="https://kepler-project.org/developers/reference/python-and-kepler">https://kepler-project.org/developers/reference/python-and-kepler</a><br>
<br>
_Christopher<br>
<br>
<br>
On 10/11/11 4:49 AM, kianwee chen wrote:<br>
<blockquote
cite="mid:CAHwgn_z_9OQFmd6U5dcu0g4vz2aDYaMNmcfr--dTw26U3O+OcQ@mail.gmail.com"
type="cite">
<div class="gmail_quote">Hi! I am a newbie in using kepler and
every now and then I will run into obstacles concerning the
usage of kepler, so I am wondering if this forum is a good place
post my questions ? <br>
<br>
I am currently trying to use the pythonscript actor in kepler to
execute an external programme ( the external programme has a
python api which I can make use of ) thus I would like to know,
does kepler has its own python interpreter ? or does it use the
python that is in the environment PATH of my OS ? Is it possible
to change the python intepreter to python that the external
programme is using to ensure that the version of python use is
the same between kepler and the external programme ?<br>
<br>
ckw </div>
<br>
</blockquote>
<pre class="moz-signature" cols="72">--
Christopher Brooks, PMP University of California
CHESS Executive Director US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust Berkeley, CA 94720-1774
ph: 510.643.9841 (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670 </pre>
</body>
</html>