Posted by
Curtis Rueden-2 on
URL: http://imagej.273.s1.nabble.com/IJ-wait-does-not-work-for-me-tp5022333p5022366.html
Hi Aryeh, Michael, everyone,
I am able to reproduce the problem with IJ.wait in Jython, using both the
ImageJ2 Script Editor and the ImageJ1 text editor. I have not dug in deeply
to understand why it happens yet, though. It might be a bug in Jython
itself. The workaround of using the time module, or Thread.sleep directly,
avoids the issue.
Michael Schmidt wrote:
> The ImageJ page on Python has a remark on possible bugs and problems;
> maybe this is one of them.
That remark is a caution about pyimagej, as opposed to Jython. But of
course there can always be bugs.
Regards,
Curtis
--
Curtis Rueden
LOCI software architect -
https://loci.wisc.edu/softwareImageJ2 lead, Fiji maintainer -
https://imagej.net/User:RuedenHave you tried the Image.sc Forum?
https://forum.image.sc/On Mon, Jul 22, 2019 at 9:39 AM Michael Schmid <
[hidden email]>
wrote:
> 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#L758>
> The 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/Python> has 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>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html