[kepler-users] python in kepler

Christopher Brooks cxh at eecs.berkeley.edu
Tue Oct 11 09:38:16 PDT 2011


.Hi ckw,
Yes, this is a good place for questions about using Kepler.

Yes, Kepler has an actor named "Python Script".  The actor uses Jython,
which is a Java implementation of Python.  Kepler is using Jython 2.2 or 
2.2.1.
I tried upgrading, but jython2.5.8 does not have 
org.python.core.PyJavaInstance.
Jython is present as a jar file in Kepler.  So, Kepler is not using an 
external
version of Python, it is using the Jython jar file at 
./ptolemy/src/lib/jython.jar.

To execute an external program, you could use the Kepler "External 
Execution" actor.
This merely invokes the program as a separate process.  This would not make
the Python in the external program visible to the Kepler process.

I'm not sure how you would interface to a Python interpreter outside of 
Kepler.
The non-Jython, outside Python interpreter is presumably written in C or 
C++.
You could use the Java Native Interface (JNI) to interface to outside 
Python shared libraries.
JNI is rather difficult to use.  Kepler uses Ptolemy II as its engine.  
Ptolemy II has
a Matlab interface that is found in the Kepler sources as 
kepler/ptolemy/src/ptolemy/matlab/
One possibility would be to implement a similar interface to Python, though
this would be a somewhat complex task.

Another possibility is to use the bcvtb facility in Ptolemy II to 
interface via a socket
to a Python process.  This is also complex, but probably easier that 
writing your
own interface.  In Ptolemy II, see $PTII/lbnl for the bcvtb interface.

I just started a page about Kepler and Python, see
https://kepler-project.org/developers/reference/python-and-kepler

_Christopher


On 10/11/11 4:49 AM, kianwee chen wrote:
> 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 ?
>
> 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 ?
>
> ckw
>
-- 
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20111011/266d3316/attachment.html>


More information about the Kepler-users mailing list