Running a Jython Script from the Command Prompt
Posted by MChapman on Feb 14, 2017; 10:05pm
URL: http://imagej.273.s1.nabble.com/Running-a-Jython-Script-from-the-Command-Prompt-tp5018100.html
Hello again,
I have a set of image processing codes that go between Python and ImageJ by calling macro scripts from Python through the command prompt. One of these calls looks like:
os.popen('"C:\Program Files\Fiji.app\ImageJ-win64.exe" --headless -macro "SomeScript.ijm"')
In attempting to integrate "Register Virtual Stack Slices" the only way that I could figure out how to script it to work autonomously was with a Jython script. The script works fine on its own, but when I try to call it from Python it won't execute, it just opens up the script in the script editor instead of executing. The call looks like this:
os.popen('"C:\Program Files\Fiji.app\ImageJ-win64.exe" --headless -jython "SomeScript.py"')
I saw on the wiki that there is a known bug with jython and running headless, so I tried:
os.popen('"C:\Program Files\Fiji.app\ImageJ-win64.exe" -jython "SomeScript.py"')
os.popen('"C:\Program Files\Fiji.app\ImageJ-win64.exe" -jython --run "SomeScript.py"')
but neither worked.
Any advice on how to get this to execute properly?
Thanks!
Mike