<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Marc,<br>
    <br>
    I updated <br>
<a class="moz-txt-link-freetext" href="https://kepler-project.org/developers/reference/python-and-kepler#how-jython-finds-imports">https://kepler-project.org/developers/reference/python-and-kepler#how-jython-finds-imports</a><br>
    to describe how to use Jython's import keyword to load a Jython
    module to define the contents of an actor.<br>
    <br>
    I modified PythonScript so that it now has a parameter that names
    the class or module to be read, this parameter must match the name
    of the import.<br>
    <br>
    outreach/workflows/demos/Python/PythonImport.xml is a model that
    imports PtPythonSquare, which is found at
    ptolemy/src/lib/Lib/PtPythonSquare.py<br>
    I set up Eclipse to use PyDev, but setting a breakpoint in
    PtPythonSquare does not work.  I believe it is because the Kepler is
    started with a Java main() and not as a Jython script.<br>
    I won't have time to look into PyDev further for awhile, there are
    other tasks on my plate.<br>
    <br>
    Below is the relevant portion of<br>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
<a class="moz-txt-link-freetext" href="https://kepler-project.org/developers/reference/python-and-kepler#how-jython-finds-imports">https://kepler-project.org/developers/reference/python-and-kepler#how-jython-finds-imports</a><br>
    <blockquote type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <p>See <a class="external-link"
href="http://jythonpodcast.hostjava.net/jythonbook/en/1.0/ModulesPackages.html">Chapter
          8: Modules and Packages for Code Reuse</a> for details, but
        basically, the Python sys.path variable stores the search path.</p>
      <p>See <a class="external-link"
href="https://lists.eecs.berkeley.edu/sympa/arc/ptolemy-hackers/2011-03/msg00011.html">Re:
          Using swing from the Python Actor; skeleton in syspath?</a>
        for a Ptolemy model that prints the contents of the sys.path
        variable and discussion about a bug.  In November, 2011, that
        model was checked in to the Ptolemy II tree as
        ptolemy/actor/lib/python/test/PythonSysPath.xml.</p>
      <p>In my default Ptolemy setup, sys.path was:</p>
      <p>/Users/cxh/ptII/vendors/jython/Lib,/Users/cxh/ptII/vendors/jython/jython.jar/Lib,__classpath__,/Users/cxh/ptII/vendors/jython/Lib</p>
      <p>In November, 2011, the Kepler devel tree was updated with
        outreach/workflows/demos/Python/PythonImport.xml.  That model
        reads a Jython module in ptolemy/src/lib/Lib/PtPythonSquare.py</p>
      <p>1. Start a development version of Kepler, and open
        outreach/workflows/demos/Python/PythonImport.xml</p>
      <p>Right click on the PythonScript actor, select Configure and
        note that jythonClassName is set to "PtPythonSquare"<br>
        <br>
        2. The Jython model to be run is at
        ptolemy/src/lib/Lib/PtPythonSquare.py.  Note that<br>
        you may need to create the Lib/ directory.  Note that the first
        lib directory starts with a lower case el and the second starts
        with an uppercase el.  Jython uses the Jython sys.path variable
        to find modules.  <br>
        <br>
        To get the value of sys.path, either:<br>
        Right click on the PythonScript actor, select "Listen to Actor"<br>
        run the model and look at the value printed on stdout<br>
        OR<br>
        Run the model at
        $PTII/ptolemy/actor/lib/python/test/PythonSysPath.xml<br>
        <br>
        The contents of PtPythonSquare.py should be:</p>
      <pre>class Main :
  def fire(self) :
  token = self.input.get(0)
  self.output.broadcast(token.multiply(token))
   return</pre>
      <p><br>
        3. Run the model, note that the output is the square of the
        input.<br>
        <br>
        4. Edit PtPythonSquare.py and change<br>
          multiply(token)<br>
        to<br>
          add(token)<br>
        <br>
        5. Run the model again, note that the output is the twice the
        input..</p>
      <p> </p>
      <p>Note that the python.home Java property controls what the
        location of the Python home directory.  In Ptolemy, try:</p>
      <p> </p>
      <pre>java -classpath $PTII:${PTII}/lib/jython.jar -Dpython.home=/tmp/bar ptolemy.vergil.VergilApplication PythonSysPath.xml</pre>
    </blockquote>
    <br>
    _Christopher<br>
    <br>
    <br>
    <br>
    On 11/7/11 9:07 AM, Christopher Brooks wrote:
    <blockquote cite="mid:4EB81053.6090805@eecs.berkeley.edu"
      type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      Hi Marc,<br>
      About updating from Jython 2.2 to 2.5.1, there is <a
        moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://bugs.jython.org/issue1814">http://bugs.jython.org/issue1814</a>. 
      My comment to that bug was:<br>
      <blockquote type="cite">BTW - For Kepler/Ptolemy, I changed calls
        like:<br>
        <br>
        new PyJavaInstance(attribute)<br>
        to<br>
        PyJavaType.wrapJavaObject(attribute)<br>
        <br>
        I have no idea if this is correct, but the Ptolemy tests passed.<br>
        Adding something to the Jython Wiki would be great.</blockquote>
      <br>
      As it stands, the PythonScript actor can import Jython code from a
      separate file by having the user edit the text widget in the
      actor.  It would not be that hard to get that import from a
      PortParameter.  I would not have time to implement anything like
      that though, I have deadlines at the end of November.   So, it
      would be fairly easy to write actors in Jython.  <br>
      <br>
      To me, it sounds like you are proposing porting more of the
      PythonActor into Jython.  This sees fairly straightforward, but a
      bit of a mind bender.  Ptolemy II has an execution semantics that
      expects that actors implement the Executable interface.  Much of
      the code expects that TypedCompositeActors contain Actors and the
      Actors have methods like preinitialize(), initialize(), fire(),
      postfire(), wrapup().  These are all Java interfaces, classes and
      methods.  So, for your actors to be called, the Java execution
      engine needs to have a way to call Java code that then in turn
      calls the Jython code that you have written.  Thus, I'm not sure
      if porting more of the PythonActor into Jython would have a pay
      off.<br>
      <br>
      Writing Jython that is read by an actor similar to the
      PythonScript actor would seem to be fairly straightforward.  The
      Jython user writes methods in Jython, Ptolemy runs the
      PythonScript actor that reads those methods.<br>
      <br>
      An alternative would be to embed the Ptolemy II execution engine
      in Jython and make calls from Jython to execute a model.  Writing
      Jython actors would still need something like PythonScript.<br>
      <br>
      I updated <a moz-do-not-send="true" 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>
      with a couple of links in the External Resources section that
      point to third parties that I believe have interfaced to the C
      version of Python using external actors.  This is yet another way
      of doing the job.  I'm resistant to shipping releases with
      interfaces to C code because of the complexity in getting JNI or
      JNA to work on multiple platforms and 32 or 64 bits.  However,
      interfacing to C code does have value sometimes.<br>
      <br>
      Scala looks pretty interesting to me, I've been meaning to look
      further into Scala.  One side idea I've been thinking of is to
      generate Scala from Ptolemy models, but I'm not sure if that is
      practical.<br>
      <br>
      _Christopher<br>
      <br>
      <br>
      <br>
      <br>
      On 11/5/11 1:54 PM, J. Marc Edwards wrote:
      <blockquote
        cite="mid:022401cc9bfd$29195920$7b4c0b60$@nimbisservices.com"
        type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=ISO-8859-1">
        <meta name="Generator" content="Microsoft Word 14 (filtered
          medium)">
        <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
        <style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Comic Sans MS";
        panose-1:3 15 7 2 3 3 2 2 2 4;}
@font-face
        {font-family:Ubuntu;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Courier New \;color\:\#1F497D";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Comic Sans MS \;color\:purple";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#993366;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
        <div class="WordSection1">
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">Christopher,

              Alan, Josh:<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">OK…this

              is important enough to me that I wanted to include Alan
              Kennedy and Josh Juneau into your response.  Christopher,
              many thanks for your effort to upgrade Kepler 2.2 to
              Jython 2.5.2.  However, I’d like to have a little more <b><u>due

                  diligence discussion</u></b> before putting it to
              rest.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">I’m

              also pasting below Alan Kennedy’s response to my earlier
              query to address the Jython 2.2 to 2.5.2
              incompatibilities.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">My

              interpretation of Alan’s response containing the term <b><u>“documentation”</u></b>
              seems to imply less of a problem and more of an
              explanation.  <b><u>Alan?</u></b><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">From

              this perspective, as a Kepler w/Jython 2.5.2 user, I
              certainly need to understand what seemed to be deemed an
              issue in being able to upgrade to Jython 2.5.2 due to the
              backward incompatibility (particularly as it related to <b>PyJavaInstance</b>),

              to you being able to fairly easily upgrade after all.  Why
              did you not run into an issue with <b>PyJavaInstance</b>
              in Jython 2.5.2?  <b><u>Are we missing some functionality
                  that users need to be aware of?</u></b><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><u><span
style="font-family:"Calibri","sans-serif";color:#993366">Back

                to my original intent of Eclipse IDE-based development
                of actors in Kepler/Ptolemy using Jython.</span></u><span
style="font-family:"Calibri","sans-serif";color:#993366"> 
              In a purely technical context, I am more comfortable using
              Jython than I am Java. Based upon my questions to the
              Jython User’s Group, I suspect that Alan and Josh are
              rolling their eyes at this comment! </span><span
              style="font-family:Wingdings;color:#993366">J</span><span
style="font-family:"Calibri","sans-serif";color:#993366">
              This is my primary motivation behind wanting to
              standardize on developing Python actors in Jython for
              Kepler.  My company, Nimbis Services, is also
              standardizing on the Jython Django web framework, and
              we’re thinking very hard about when we will begin a full
              evaluation of Scala (a JVM functional programming
              language).  <o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">I
              am thinking that all I need to do is to take the Ptolemy
              PythonActor source code and take a look at the Java code
              for that actor and recode the actor in Jython (Let’s call
              this new actor JythonActor) from within Eclipse.  I’d like
              a suggestion from Josh or Alan regarding architecturally
              how they would address the following issue:<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">Using

              a Jython package, or function call, or interface (probably
              not applicable in Jython), have the newly coded
              JythonActor call the externally developed “functional
              core” of the Python script that would effectively
              “customize” the PythonActor according to the Jython
              script’s behavior.  This way I would only develop my
              Jython script packages and then integrate these into the
              newly coded JythonActor through say a port parameter. 
              Better yet, how about some sort of XML import solution
              that would identify the Jython code that “decorates” the
              JythonActor’s functionality.  I need a good suggestion on
              how to do this elegantly such that it looks like someone
              with serious programming skills thought it through and not
              kluge code from a chip designer.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">At

              present, the PythonActor solution is not integrated into
              the full functional Eclipse-based JVM flow due to the Java
              implementation. I have become far too reliant upon
              debugging my Jython code through the Eclipse IDE and the
              interpretive nature of Jython to not have this working
              flawlessly.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">Please

              let me know what each you think of my JythonActor
              approach.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">Alan,

              Josh…Christopher is particularly interested in addressing
              Jython licensing issues.  I get the gist of what he is
              after here, but I have simply not been part of any of
              this, so I have to defer to kind attention on this
              subject.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366">Kind

              regards, Marc<o:p></o:p></span></p>
          <div class="MsoNormal" style="text-align:center"
            align="center"><span
style="font-family:"Calibri","sans-serif";color:#993366">
              <hr align="center" size="2" width="100%"></span></div>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">[J. Marc]<o:p></o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">> OK…please connect me with
                one of the Jython 2.2 to 2.5 developers.  I <o:p></o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">> will then work with them
                to determine how we could most effectively <o:p></o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">> migrate Kepler 2.2 from
                Jython 2.2 to Jython 2.5.2.<o:p></o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">><o:p> </o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">> I will be working with one
                of the Kepler/Ptolemy II developers on this <o:p></o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">> migration.<o:p></o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060"><o:p> </o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">This issue with PyJavaInstance
                when upgrading from 2.2 to 2.5 seems to be a common
                enough issue that it requires documentation.<o:p></o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060"><o:p> </o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">I'm not going to get to it
                immediately myself, so I've created an issue on the
                issue tracker for it, if anyone feels like taking that
                up.<o:p></o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060"><o:p> </o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060"><a moz-do-not-send="true"
                  class="moz-txt-link-freetext"
                  href="http://bugs.jython.org/issue1814">http://bugs.jython.org/issue1814</a><o:p></o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060"><o:p> </o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">Regards,<o:p></o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060"><o:p> </o:p></span></b></p>
          <p class="MsoNormal"><b><span style="font-family:"Courier
                New";color:#002060">Alan.<o:p></o:p></span></b></p>
          <div class="MsoNormal" style="text-align:center"
            align="center"><span
style="font-family:"Calibri","sans-serif";color:#993366">
              <hr align="center" size="2" width="100%"></span></div>
          <div>
            <p class="MsoNormal"><u><span
style="font-size:14.0pt;font-family:"Calibri","sans-serif";color:#993366">J.

                  Marc Edwards, Lead Architect</span></u><span
style="font-size:14.0pt;font-family:"Calibri","sans-serif";color:#993366"><o:p></o:p></span></p>
            <p class="MsoNormal"><i><span
style="font-family:"Calibri","sans-serif";color:#002060">Semiconductor

                  Design Portals<o:p></o:p></span></i></p>
            <p class="MsoNormal"><b><span
style="font-size:14.0pt;font-family:"Calibri","sans-serif";color:#993366">Nimbis

                  Services, Inc.<o:p></o:p></span></b></p>
            <p class="MsoNormal"><span style="font-family:"Courier
                New";color:#993366">Cell  - (919) 345-1021<o:p></o:p></span></p>
            <p class="MsoNormal"><span style="font-family:"Courier
                New";color:#993366">Fax   - (919) 882-8602<o:p></o:p></span></p>
            <p class="MsoNormal"><span style="font-family:"Courier
                New";color:#993366">Skype - (919) 747-3775<o:p></o:p></span></p>
            <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#C00000"><a
                  moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:jmarcedwards@gmail.com">jmarcedwards@gmail.com</a><o:p></o:p></span></p>
            <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#C00000"><a
                  moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:marc.edwards@nimbisservices.com">marc.edwards@nimbisservices.com</a><o:p></o:p></span></p>
          </div>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#993366"><o:p> </o:p></span></p>
          <div>
            <div style="border:none;border-top:solid #B5C4DF
              1.0pt;padding:3.0pt 0in 0in 0in">
              <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
                  Christopher Brooks [<a moz-do-not-send="true"
                    class="moz-txt-link-freetext"
                    href="mailto:cxh@eecs.berkeley.edu">mailto:cxh@eecs.berkeley.edu</a>]
                  <br>
                  <b>Sent:</b> Saturday, November 05, 2011 2:59 PM<br>
                  <b>To:</b> <a moz-do-not-send="true"
                    class="moz-txt-link-abbreviated"
                    href="mailto:marc.edwards@nimbisservices.com">marc.edwards@nimbisservices.com</a><br>
                  <b>Cc:</b> J. Marc Edwards; <a moz-do-not-send="true"
                    class="moz-txt-link-abbreviated"
                    href="mailto:kepler-users@kepler-project.org">kepler-users@kepler-project.org</a><br>
                  <b>Subject:</b> Re: [kepler-users] Python execution
                  within the Kepler Python actor...<o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">Hi Marc,<br>
            I updated Jython to 2.5.2, it was not that hard, updating
            the license files took the most time.<br>
            <br>
            I have a few of misgivings about Jython that might be good
            lessons for Ptolemy and Kepler:<br>
            <br>
            * Sadly, ptII/lib/jython.jar went from about 1Mb to 10Mb. 
            Does this mean that Jython-2.5.2 is 10 times better than
            Jython-2.2.1?<br>
            If jython is supposed to be a scripting language, then why
            is it so large?<br>
            This seems to be a common trend where nice small languages
            get more and more features.<br>
              As an aside about Perl, see <br>
              Is Perl Better Than a Randomly Generated Programming
            Language? at<br>
              <a moz-do-not-send="true"
href="http://developers.slashdot.org/story/11/10/27/213231/is-perl-better-than-a-randomly-generated-programming-language">http://developers.slashdot.org/story/11/10/27/213231/is-perl-better-than-a-randomly-generated-programming-language</a><br>
            <br>
            For comparison purposes, Ptolemy's ptsupport.jar is 3.5Mb
            and a standalone Ptolemy demo including the GUI is 6.5Mb in
            jars.<br>
            <br>
            Lesson: we need to keep an eye on code bloat and be able to
            deploy small run times.<br>
            <br>
            * Another issue with Jython-2.5.2 is that because they
            removed org.python.core.PyJavaInstance some time after
            Jython-2.2.1, they should have released Jython-2.5.2 as
            Jython-3.x.  Most projects bump up the major version number
            when there are incompatibilities.<br>
            <br>
            Lesson: Ptolemy bumps up the major version number with each
            ~yearly release.  Ptolemy has backward compatibility
            filters.  We do sometimes remove old code, but only with
            major versions.<br>
            <br>
            * The Jython license situation is a mess.<br>
            <a moz-do-not-send="true"
              href="http://www.jython.org/license.html">http://www.jython.org/license.html</a>
            lists these licenses<br>
            - The Python Software Foundation License Version 2, which
            according to Wikipedia is a BSD-style license<br>
            - The Jython-2.0 and 2.1 license, which is similar to a
            BSD-style license<br>
            - The JPython 1.1.x license, which is similar to BSD-style
            license<br>
            <br>
            The software ships with these licenses in the LICENSE.txt
            file.<br>
            <br>
            However, LICENSE_CPython.txt and LICENSE_Apache.txt are
            included.  There is no mention as to what code actually uses
            those licenses.<br>
            LICENSE_CPython.txt includes four copyrights: <br>
             - Python Software Foundation License Version 2<br>
             - BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0<br>
             - CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1<br>
             - CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2<br>
            The last three look similar to BSD, but have various
            requirements.<br>
            <br>
            I'll submit a bug report to Jython to get them to update
            their site.<br>
            <br>
            Lesson: I'm not sure how Ptolemy and Kepler can avoid a
            similar complexity issue.  I've been working on updating our
            license file and<br>
            we have a way to determine what licenses are used by a
            particular configuration.<br>
            <a moz-do-not-send="true"
              href="http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/copyright.htm">http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/copyright.htm</a>
            <br>
            lists 7 licenses used by Ptiny, a small configuration of
            Ptolemy II.  One of those 7 is the Jython-2.2.1 license,
            which is similar to the Jython-2.5.2 license.<br>
            The Kepler configuration of Ptolemy II uses 15 licenses in
            the Ptolemy II code.<br>
            <br>
            _Christopher<br>
            <br>
            On 11/5/11 9:15 AM, J. Marc Edwards wrote: <o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Christopher:</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">I
              suspect that I can simply code an entire actor extending
              the respective classes directly in Jython.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">That

              is what I am thinking.  Please let me know what you think
              of this strategy.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">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.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Let’s

              talk on the phone on Monday.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Regards,

              Marc</span><o:p></o:p></p>
          <div>
            <p class="MsoNormal"><u><span
style="font-size:14.0pt;font-family:"Calibri","sans-serif";color:#1F497D">J.

                  Marc Edwards, Lead Architect</span></u><o:p></o:p></p>
            <p class="MsoNormal"><i><span
style="font-family:"Calibri","sans-serif";color:#002060">Semiconductor

                  Design Portals</span></i><o:p></o:p></p>
            <p class="MsoNormal"><b><span
style="font-size:14.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Nimbis

                  Services, Inc.</span></b><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:"Courier
                New ;color:#1F497D","serif"">Cell  -
                (919) 345-1021</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:"Courier
                New ;color:#1F497D","serif"">Fax   -
                (919) 882-8602</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:"Courier
                New ;color:#1F497D","serif"">Skype -
                (919) 747-3775</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#C00000"><a
                  moz-do-not-send="true"
                  href="mailto:jmarcedwards@gmail.com">jmarcedwards@gmail.com</a></span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#C00000"><a
                  moz-do-not-send="true"
                  href="mailto:marc.edwards@nimbisservices.com">marc.edwards@nimbisservices.com</a></span><o:p></o:p></p>
          </div>
          <p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
          <div>
            <div style="border:none;border-top:solid #B5C4DF
              1.0pt;padding:3.0pt 0in 0in 0in">
              <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
                  Christopher Brooks [<a moz-do-not-send="true"
                    href="mailto:cxh@eecs.berkeley.edu">mailto:cxh@eecs.berkeley.edu</a>]
                  <br>
                  <b>Sent:</b> Friday, November 04, 2011 9:00 PM<br>
                  <b>To:</b> <a moz-do-not-send="true"
                    href="mailto:marc.edwards@nimbisservices.com">marc.edwards@nimbisservices.com</a><br>
                  <b>Cc:</b> <a moz-do-not-send="true"
                    href="mailto:kepler-users@kepler-project.org">kepler-users@kepler-project.org</a><br>
                  <b>Subject:</b> Re: [kepler-users] Python execution
                  within the Kepler Python actor...</span><o:p></o:p></p>
            </div>
          </div>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal">Hi Marc,<br>
            <br>
            On 11/4/11 2:09 PM, J. Marc Edwards wrote: <o:p></o:p></p>
          <p class="MsoNormal">I need a little help in integrating my
            Jython/Python code into the Python actor.<br>
            <br>
            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.<o:p></o:p></p>
          <p class="MsoNormal">I don't know that much about Python, but
            I believe that you could use the Python import facility to
            find imports.<br>
            I just added text to the Kepler Jython page about this, see:<br>
            <a moz-do-not-send="true"
href="https://kepler-project.org/developers/reference/python-and-kepler#how-jython-finds-imports">https://kepler-project.org/developers/reference/python-and-kepler#how-jython-finds-imports</a><br>
            <br>
            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.<br>
            <br>
            <br>
            <o:p></o:p></p>
          <p class="MsoNormal">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?).<o:p></o:p></p>
          <p class="MsoNormal">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.<br>
            <br>
            <br>
            <o:p></o:p></p>
          <p class="MsoNormal">After this all of the Java code for the
            actor follows with the standard initialize(), stop(),
            stopFire(), preinitialize(), terminate(), etc, methods.<br>
            <br>
            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.<br>
            <br>
            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.<br>
            <br>
            Can someone tell me how to go about achieving this
            objective?<o:p></o:p></p>
          <p class="MsoNormal">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<br>
            <br>
            <a moz-do-not-send="true"
href="http://jythonpodcast.hostjava.net/jythonbook/en/1.0/ModulesPackages.html">http://jythonpodcast.hostjava.net/jythonbook/en/1.0/ModulesPackages.html</a><br>
            <br>
            _Christopher<br>
            <br>
            <br>
            <o:p></o:p></p>
          <p class="MsoNormal"><br>
            Thanks, Marc<o:p></o:p></p>
          <div>
            <p class="MsoNormal">-- <br>
              <br>
              <br>
              <o:p></o:p></p>
            <p><span style="font-size:13.0pt;font-family:"Comic
                Sans MS ;color:purple","serif"">J. Marc
                Edwards</span><span style="font-family:"Comic Sans
                MS""><br>
                Lead Architect - Semiconductor Design Portals</span><br>
              <span
style="font-size:13.5pt;font-family:"Arial","sans-serif";color:#3333FF">Nimbis

                Services, Inc.</span><br>
              <span style="font-family:"Courier New"">Skype:
                (919) 747-3775<br>
                Cell:  (919) 345-1021<br>
                Fax:   (919) 882-8602</span><br>
              <span
                style="font-family:"Ubuntu","serif""><a
                  moz-do-not-send="true"
                  href="mailto:marc.edwards@nimbisservices.com">marc.edwards@nimbisservices.com</a><br>
                <a moz-do-not-send="true"
                  href="http://www.nimbisservices.com">www.nimbisservices.com</a></span><o:p></o:p></p>
          </div>
          <p class="MsoNormal"><br>
            <br>
            <br>
            <br>
            <o:p></o:p></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>Kepler-users mailing list<o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a><o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a><o:p></o:p></pre>
          <p class="MsoNormal"><br>
            <br>
            <br>
            <o:p></o:p></p>
          <pre>-- <o:p></o:p></pre>
          <pre>Christopher Brooks, PMP                       University of California<o:p></o:p></pre>
          <pre>CHESS Executive Director                      US Mail: 337 Cory Hall<o:p></o:p></pre>
          <pre>Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774<o:p></o:p></pre>
          <pre>ph: 510.643.9841                                (Office: 545Q Cory)<o:p></o:p></pre>
          <pre>home: (F-Tu) 707.665.0131 cell: 707.332.0670 <o:p></o:p></pre>
          <p class="MsoNormal"><br>
            <br>
            <o:p></o:p></p>
          <pre>-- <o:p></o:p></pre>
          <pre>Christopher Brooks, PMP                       University of California<o:p></o:p></pre>
          <pre>CHESS Executive Director                      US Mail: 337 Cory Hall<o:p></o:p></pre>
          <pre>Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774<o:p></o:p></pre>
          <pre>ph: 510.643.9841                                (Office: 545Q Cory)<o:p></o:p></pre>
          <pre>home: (F-Tu) 707.665.0131 cell: 707.332.0670 <o:p></o:p></pre>
        </div>
      </blockquote>
      <br>
      <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>
    </blockquote>
    <br>
    <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>