Fiji Jython-scripting error after update


#1

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 net.imagej.app.ToplevelImageJApp.getVersion(ToplevelImageJApp.java:66)
at org.scijava.welcome.DefaultWelcomeService.firstRunPrefKey(DefaultWelcomeService.java:139)
at org.scijava.welcome.DefaultWelcomeService.isFirstRun(DefaultWelcomeService.java:115)
at org.scijava.welcome.DefaultWelcomeService.onEvent(DefaultWelcomeService.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.scijava.event.DefaultEventService$ProxySubscriber.onEvent(DefaultEventService.java:302)
at org.scijava.event.DefaultEventService$ProxySubscriber.onEvent(DefaultEventService.java:276)
at org.bushe.swing.event.ThreadSafeEventService.publish(ThreadSafeEventService.java:971)
at org.scijava.event.DefaultEventBus.access$101(DefaultEventBus.java:56)
at org.scijava.event.DefaultEventBus$1.run(DefaultEventBus.java:190)
at org.scijava.thread.DefaultThreadService$1.run(DefaultThreadService.java:174)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

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.

Cheers,
David


#2

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

have a nice day
Emanuele


#3

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?

Best,
Stefan


#4

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!

Cheers,
David


#5

https://github.com/fiji/fiji/issues/172#issuecomment-327848674