Posted by
Michael Schmid on
URL: http://imagej.273.s1.nabble.com/IJ-wait-does-not-work-for-me-tp5022333p5022335.html
Hi Aryeh,
in my view, the code for IJ.wait is so simple there can't be anything
wrong with it:
https://github.com/imagej/imagej1/blob/master/ij/IJ.java#L758The only problem that can imagine is python not waiting for the command
to finish, possibly because there is no output that it waits for (it is
a void method). If this is the case, it would indicate that there can be
also other race conditions with controlling ImageJ from Python.
Which Python interface are you using, Jython, pyimagej, or something else?
The ImageJ page on Python
https://imagej.net/Pythonhas a remark on possible bugs and problems; maybe this is one of them.
If the Python-ImageJ interface has such a problem, this could also
explain your problem with IJ.renameResult mentioned in your second mail.
Then, it would be also likely that image processing via sequential
"IJ.run(...)" commands from python can fail.
If this is a real problem and there is no other solution (Python users,
any ideas???), I could imagine a workaround using java reflection,
adding a method that calls a void IJ method with a given name via Java
reflection and returns a dummy result. Then, python users would have to
call that method instead of directly calling the IJ method.
Michael
________________________________________________________________
On 21.07.19 18:53, Aryeh Weiss wrote:
> There is a place in a python script where I want to wait for a
second. So I tried IJ.wait(1000).
>
> This resulted in an error which appears in the screenshot (I could
not copy the text of the output or error windows)
>
> However, if I do
> import time
> time.sleep(1)
>
> it works fine.
>
> What have I done wrong in using the IJ.wait() function?
>
> tnx in advance
> --aryeh
>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html