Fiji Jython-scripting error after update


Dear All,

Until I did an update this afternoon Fiji worked like a charm. I was using an older version I downloaded originally the 22nd of October but kept it updated from time to time. Now when I open it, I get this error and I can’t do anything.

[ERROR] Exception during event handling:
[Event] org.scijava.ui.event.UIShownEvent
context = org.scijava.Context@37763233
consumed = false
ui = legacy
[Subscriber] org.scijava.welcome.DefaultWelcomeService [priority = 0.0]
[Method] protected void org.scijava.welcome.DefaultWelcomeService.onEvent(org.scijava.ui.event.UIShownEvent)
java.lang.NoSuchMethodError: net.imagej.legacy.LegacyService.getCombinedVersion()Ljava/lang/String;
at org.scijava.welcome.DefaultWelcomeService.firstRunPrefKey(
at org.scijava.welcome.DefaultWelcomeService.isFirstRun(
at org.scijava.welcome.DefaultWelcomeService.onEvent(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.scijava.event.DefaultEventService$ProxySubscriber.onEvent(
at org.scijava.event.DefaultEventService$ProxySubscriber.onEvent(
at org.bushe.swing.event.ThreadSafeEventService.publish(
at org.scijava.event.DefaultEventBus.access$101(
at org.scijava.event.DefaultEventBus$
at org.scijava.thread.DefaultThreadService$
at java.awt.event.InvocationEvent.dispatch(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$500(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

So I downloaded a newer version and replaced it. But now my jython scripts don’t work and throw errors in three instances that I didn’t have before:

When I want to recompile self-written modules with the sys.modules.clear() command, after that I need to restart Fiji, since every script stop to work
GenericDialog.getNextNumber() always results in a float, even when it isn’t
When I run a script, the if name == “main”: is not been recognized
What shall I do, I really am desperate, since I don’t have any working Fiji version left.



dear @dcolam,
please check this post with solution
Jython isssue with if __name__ == '__main__':

have a nice day


GenericDialog.getNextNumber() returns a Java double which is mapped to a Python float by Jython. You will have to take care of a conversion yourself.

Did this work before the update?



Yes, everything was fine before the update. Also GenericDialog.getNextNumber() returned an integer when you defined the third parameter of GenericDialog.addNumericField() as a zero (number of digits). But yeah, it’s easily fixable.
However, the other stuff is annoying, especially the sys.modules.clear() function, which forces Jython to recompile my modules after every run.
@emartini, I will have a look at this post, thanks!