Login  Register

Re: trakEM jython script does not work in newer versions of Fiji

Posted by Albert Cardona-2 on Oct 17, 2014; 9:34am
URL: http://imagej.273.s1.nabble.com/trakEM-jython-script-does-not-work-in-newer-versions-of-Fiji-tp5010088p5010089.html

Hi Moritz,

Fiji does no longer autoimport classes. Add this to the top:

from ini.trakem2.display import Display


... and the jython script will work again.

Best regards,

Albert


> On Oct 16, 2014, at 7:45 AM, "Kirschmann, Moritz" <[hidden email]> wrote:
>
> Dear TrakEM developers and experts,
>
> A jython script which has worked just fine for years, is broken by new versions of imagej and Fiji.
> In the line of code
> front = Display.getFront()
> I get the message:
> NameError: name 'Display' is not defined
> Is there a workaround for this or a bug fix in sight, besides keeping an old version of Fiji?
> Below is the full error message.
>
> Thank you very much for your help!
>
> Best regards from Switzerland, Moritz
>
>
>
>
>
>
> Started Selectcolorinmultiplelayersver5_2mo.py at Wed Oct 15 15:57:40 CEST 2014
> Traceback (most recent call last):
>  File "C:\Users\kirsmori\Dropbox\FMI\Imagej_macros\EM_related\Selectcolorinmultiplelayersver5_2mo.py", line 79, in <module>
>    front = Display.getFront()
> NameError: name 'Display' is not defined
>
>               at org.python.core.PyException.fillInStackTrace(PyException.java:70)
>               at java.lang.Throwable.<init>(Throwable.java:181)
>               at java.lang.Exception.<init>(Exception.java:29)
>               at java.lang.RuntimeException.<init>(RuntimeException.java:32)
>               at org.python.core.PyException.<init>(PyException.java:46)
>               at org.python.core.PyException.<init>(PyException.java:43)
>               at org.python.core.PyException.<init>(PyException.java:61)
>               at org.python.core.Py.NameError(Py.java:260)
>               at org.python.core.PyFrame.getname(PyFrame.java:257)
>               at org.python.pycode._pyx2.f$0(C:\Users\kirsmori\Dropbox\FMI\Imagej_macros\EM_related\Selectcolorinmultiplelayersver5_2mo.py:148)
>               at org.python.pycode._pyx2.call_function(C:\Users\kirsmori\Dropbox\FMI\Imagej_macros\EM_related\Selectcolorinmultiplelayersver5_2mo.py)
>               at org.python.core.PyTableCode.call(PyTableCode.java:165)
>               at org.python.core.PyCode.call(PyCode.java:18)
>               at org.python.core.Py.runCode(Py.java:1275)
>               at org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76)
>               at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
>               at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
>               at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
>               at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
>               at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:164)
>               at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>               at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>               at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>               at java.lang.Thread.run(Thread.java:619)
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html