[kepler-users] Python execution within the Kepler Python actor...

J. Marc Edwards jmarcedwards at gmail.com
Sat Nov 5 09:15:12 PDT 2011


Christopher:

 

I suspect that I can simply code an entire actor extending the respective
classes directly in Jython.

 

That is what I am thinking.  Please let me know what you think of this
strategy.

 

Of course, while I do this, I want to migrate a Kepler development tree to
use Jython 2.5.2, which I will need your assistance in completing.

 

Let's talk on the phone on Monday.

 

Regards, Marc

J. Marc Edwards, Lead Architect

Semiconductor Design Portals

Nimbis Services, Inc.

Cell  - (919) 345-1021

Fax   - (919) 882-8602

Skype - (919) 747-3775

jmarcedwards at gmail.com

marc.edwards at nimbisservices.com

 

From: Christopher Brooks [mailto:cxh at eecs.berkeley.edu] 
Sent: Friday, November 04, 2011 9:00 PM
To: marc.edwards at nimbisservices.com
Cc: kepler-users at kepler-project.org
Subject: Re: [kepler-users] Python execution within the Kepler Python
actor...

 

Hi Marc,

On 11/4/11 2:09 PM, J. Marc Edwards wrote: 

I need a little help in integrating my Jython/Python code into the Python
actor.

When I double-click on the Python actor in the PythonDialogExample, a window
with the Python code appears.  I can of course edit the code from within
this window.  However, I want to perform my code development and editing
from within my Eclipse environment from my Kepler development build.

I don't know that much about Python, but I believe that you could use the
Python import facility to find imports.
I just added text to the Kepler Jython page about this, see:
https://kepler-project.org/developers/reference/python-and-kepler#how-jython
-finds-imports

Note that I found a few other references on the web, included what appears
to be people who are using the full version of Python (not Jython) with
Kepler.



When I "open the actor", the beginning of the file has some Javadoc as well
as what appear to be some unmatched XML elements (<p>), along with some
matching XML element tags (</pre>) (does this correspond to some pre-fire
method?).

When you open the actor, you are seeing the Java code that implements the
PythonActor.  The <p> tags are html tags used in the javadoc comments of the
Java file.  All of the instances of the PythonActor share the same Java
code, but may have different Python code.



After this all of the Java code for the actor follows with the standard
initialize(), stop(), stopFire(), preinitialize(), terminate(), etc,
methods.

I do see in the Java code where there is a PythonScript method that accepts
a CompositeEntity where a script template is provided where I am supposing a
long Python string in the script.setExpression is defined.

However, what I would like to do is simply include my Jython module within
my Kepler build and debug my Jython code in connection with my overall
workflow.

Can someone tell me how to go about achieving this objective?

It looks like Jython uses sys.path to find imports.  I included a Ptolemy II
model that opens in the devel version of Kepler that lists the contents of
sys.path.  For further information about sys.path, see

http://jythonpodcast.hostjava.net/jythonbook/en/1.0/ModulesPackages.html

_Christopher




Thanks, Marc

-- 



J. Marc Edwards
Lead Architect - Semiconductor Design Portals
Nimbis Services, Inc.
Skype: (919) 747-3775
Cell:  (919) 345-1021
Fax:   (919) 882-8602
marc.edwards at nimbisservices.com
www.nimbisservices.com






_______________________________________________
Kepler-users mailing list
Kepler-users at kepler-project.org
http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users





-- 
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/20111105/7f245e8d/attachment.html>


More information about the Kepler-users mailing list