I'm guessing there's no way to update to Jython 2.7?

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

I'm guessing there's no way to update to Jython 2.7?

Postby cpadilla@tamu.edu » Fri Mar 29, 2019 1:24 pm

I noticed the version of Python used by the Automaton inside of Cameo is 2.5.3. Many more external libraries work a lot nicer with 2.7, so I'm guessing there's no way to upgrade to 2.7?
cpadilla@tamu.edu
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:0
Joined: Tue Feb 12, 2019 3:00 pm

Re: I'm guessing there's no way to update to Jython 2.7?

Postby lonniev@gmail.com » Fri Feb 21, 2020 8:04 pm

You might be able to just replace the ScriptEngine JAR for Jython in the plugins\com.nomagic.magicdraw.automaton\lib\engines\jython directory. I do the similar upgrade to get more recent versions of jRuby. You likely will need to update the filename for the engine's jar in the plugin.xml file.

I write "might" because you also might encounter an evolution issue like I do with recent jRudy. The convention used to pass arguments from MD's java context to the jRuby ScriptEngine session changed a few years ago (I forget for which point release of jRuby. jRuby is now at 9.2.10.0 while MD ships with ancient jRuby 1.7.) What has happened for jRuby is that in the past, arguments from MD appeared as $-prefixed global-variables in the Ruby code but recent jRuby expects to see arguments as local-variable instances without the $ prefix. So old scripts don't work with the new jRuby and new scripts don't work with the old MD.

There is a tiny bit of MD user manual guidance on installing a different or additional JSR223 ScriptEngine.

Good Luck.
lonniev@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 11
Posts Rating:0
Joined: Mon Oct 15, 2018 1:56 pm


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 6 guests