pyimagej icon indicating copy to clipboard operation
pyimagej copied to clipboard

ij.py.run_script returns the wrong type

Open gselzer opened this issue 1 year ago • 1 comments

ij.py.run_script promises to return a java map, but it returns a ScriptModule instead. Should be a simple change to simply call getOutputs on the return of .get().

gselzer avatar Oct 22 '24 21:10 gselzer

@elevans was thinking about just fixing this, but I'd want to write a test - where do you think it should live?

gselzer avatar Oct 22 '24 21:10 gselzer

Great catch and definitely something we should fix. ij.py.run_macro will also need the same treatment. I have two commits ready that applies the fixes, clarifies the doc string and also adds test_macro_script.py file to our tests.

My main question is do we need to test all the supported languages?

elevans avatar Jul 25 '25 18:07 elevans

Yeah, I think all you need to test is the return type from ij.py.run_script from one language - it's pyimagej's job to get the correct outputs from the ScriptService, and it's each scijava/scripting-* module to process a script in a uniform way. I'd think just testing each of the pyimagej code paths is probably sufficient

gselzer avatar Jul 28 '25 13:07 gselzer