Jython scripting wiki page Script Example breaks

wiki
plugin
python
scripting
Tags: #<Tag:0x00007fa307692100> #<Tag:0x00007fa307691f20> #<Tag:0x00007fa307691d90> #<Tag:0x00007fa307691bb0>

#1

I just thought I’d suggest a quick edit for the jython wiki page examples! I’m somewhat familiar with python for other scripting uses, and I thought I’d experiment a bit with using it to create some functionality in imageJ. When I tried the first example script on the wiki, it took me a little de-bugging to figure out why it didn’t create any example images. I’m not a sophisticated coder by any means, and I’m not used to the partitioning syntax at the end of python codes that goes like this:

if __name__ == '__main__':
    run_script()

There is another topic on the forum about this not working with the current version of fiji here. My suggestion is to edit the code examples on the wiki to incorporate the suggested fix below:

if __name__ in ['__builtin__','__main__']:
    run_script()

#2

You are right, it is referenced on the forum but not corrected in the scripts.
For some scripts presented on the wiki, it is possible to directly edit them but for those they are read directly from Github so I have submitted a pull request :wink: