[kepler-users] Python execution within the Kepler Python actor...
Christopher Brooks
cxh at eecs.berkeley.edu
Fri Nov 4 18:00:08 PDT 2011
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/20111104/9019e59d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PythonSysPath.xml
Type: text/xml
Size: 4761 bytes
Desc: not available
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20111104/9019e59d/attachment.xml>
More information about the Kepler-users
mailing list