We need to upgrade to Python 2.7 at some point. There are a number of nice things they added to the language, and the Jython implementation is "cleaner" than the 2.2 implementation we use. But with the changes this will be a non-trivial task.
Also there are convenient hacks I use where I make classes that are privy to Jython internals because they are in the same package. These will probably cause problems as well.
Also this needs to be fixed at some point, where Jython tries to create a cache folder under the present working folder:
*sys-package-mgr*: can't create package cache dir, '/home/jbf/project/rbsp/study/bill/digitizing/convertToCdf/autoplot.jar/cachedir/packages'
I verified that the syntax tree code in Jython 2.7 is similiar to 2.2.
Sebastian was looking for the "set" command.
Note Jython2.7 (beta3) is compiled with Java7.
See http://jyni.org/ which is the library that will allow SciPy to be accessed.
As an experiment, I checked out the Autoplot source and tore out code until I could get Python 2.7 to compile. Ed showed me how to get the operator overloading to work, and I've verified that as well. (It is all much cleaner now.) (This code is in
/home/jbf/ct/autoplot/jython27/autoplot15353/JythonSupport/src/org/virbo/jythonsupport/QDataSetAdapter.java)
I need to work up a set of codes to run before and after to verify the change, beyond what is already tested. There was one type of operation where you had to explicitly convert the operand to QDataSet with dataset() to get it to work, and I bet this can work with 2.7.
Also the AST stuff needs to be done. With the 2.7 change I would like to clean the bits of code that would use the non-parser.
Also recent debugging changes, based on pdb, can be verified with this branch.
Last edit: Jeremy Faden 2014-10-29
The stack trace should also indicate the name of the jython script that is running, and better present this information to the user. I've learned that
...
at org.python.pycode._pyx10.f$0(<iostream>:89)
at org.python.pycode._pyx10.call_function(<iostream>)
...
means it's at line 89 of my Jython script, but I've never figured out if there's a way I could get this information in a program. I suspect this may change with Jython 2.7, so I'm mentioning it here.
This is all that should be shown:
Traceback (innermost last):
and not:
I've been playing with this at U. Iowa. See sftp://nudnik.physics.uiowa.edu/home/jbf/eg/jython/Jython27/DemoJython27
Jython 2.2 supports named parameters in string replacement, like this:
pp= { 'period1':str(tr.min().doubleValue(Units.t1970)),
'period2':str(tr.max().doubleValue(Units.t1970)),
'interval':getParam( 'interval', '1d', 'the resolution', ['1d','1wk','1mo'] ),
'crumb':getParam('crumb','bJ6Je5cZh3m','the crumb provided by their server') }
args= 'period1=%(period1)s&period2=%(period2)s&interval=% (interval)s&events=history&crumb=%(crumb)s' % pp
u=URL( 'https://query1.finance.yahoo.com/v7/finance/download/%EGSPC?' + args )
(Note the s in %()s, which indicates type.) Jython 2.7 introduces the string.format command, which is supposed to be cleaner.
Last edit: Jeremy Faden 2019-01-03
The templates stuff was getting in my way again. It's hard to find documentation for the supported old-stype substitution.
See also https://sourceforge.net/p/autoplot/bugs/1745/