<div dir="ltr"><div class="gmail_extra">Hi Harri,<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">java.lang.<div class="im">IllegalArgumentException:
      java.lang.IllegalArgumentException: No compatible service:
      io.scif.SCIFIOService<br></div>
      hajaalin@biotek973:~/Software/<div>mvn-IJ2$ jar tvf
      target/dependency/scifio-0.9.2.jar |grep SCIFIOService<br>
         150 Fri Feb 14 16:24:24 EET 2014 io/scif/SCIFIOService.class</div></blockquote><br></div><div class="gmail_extra">So this exception may be slightly misleading. SCIFIOService is a marker interface for all the services that are part of SCIFIO. When an org.scijava.Context is initialized as it is here, it's typically given a set of base service interfaces and then loads all implementations of that service. So it seems like the Context knows about the SCIFIOService interface, but didn't discover any implementations (things like DefaultFormatService, DefaultImgUtilityService).<br>

<br> So this brings me to my next point: I think there is either a) a bug in jython where annotations are not preserved or b) a bug with the class loading logic used by Fiji/IJ2. I am leaning towards a) right now.<br><br>

</div><div class="gmail_extra"> I am using an Ubuntu 12.04 64-bit VM. I installed Jython 2.5.3, but I suspect you can get this working with 2.5.1.<br><br></div><div class="gmail_extra"> Anyway, I went back to OSX and tested jython with the -Dpython.path option, and got the same missing service exception. But! If I set $CLASSPATH (java automatically picks up the $CLASSPATH environment variable) and run the equivalent of:<br>

<br></div><div class="gmail_extra">jython macros/imglib0.py /home/hajaalin/Data/Misha/composite1.ome.tif<br><br></div><div class="gmail_extra">it works! Thus I believe that python.path has a bug and although jython supports discovery of classes on python.path, it does not preserve their annotations (or some similar metadata is being lost).<br>

<br></div><div class="gmail_extra">So instead of setting CP and passing it via -Dpython.path, just use:<br><br></div><div class="gmail_extra">export CLASSPATH=`find /home/hajaalin/Software/fiji-20140219/Fiji.app/jars -name '*.jar' |sed ':a;N;$!ba;s/\n/:/g'`<br>

<br></div><div class="gmail_extra">A simple rule of thumb is, try running a random SCIFIO class like "java io.scif.SCIFIOService" from the command line. If you get a NoClassDef error, your CLASSPATH is not configured correctly. If you get a "NoSuchMethodError: main", your CLASSPATH is correct and your jython will pick up all the desired classes.<br>

</div><div class="gmail_extra"><br></div><div class="gmail_extra">Moving on...<br></div><div class="gmail_extra"><br>jython macros/imglib0.py /home/hajaalin/Data/Misha/composite1.ome.tif<br><br></div><div class="gmail_extra">

^ That then works a bit better with my CLASSPATH set, except I get a different runtime error about how ImgMode.CELL can't be coerced to ImgMode. (same error I get when running using Fiji).<br><br></div><div class="gmail_extra">

I notice that you aren't actually using the SCIFIOConfig you construct, so if you delete those lines and I'm finally able to open an image. The SCIFIOConfig isn't strictly necessary either - SCIFIO will open it as a CellImg automatically if it needs to. I will try to investigate further as to how to get the types working for a nested enum in jython..<br>

<br></div><div class="gmail_extra">You may see yet another error message about io.scif.bf.BioFormatsFormat failing. This is because some jars in Fiji are out of date, but that shouldn't cause catastrophic failure (it just means that some proprietary formats won't be supported right now). These jars should be updated this week.<br>

<br></div><div class="gmail_extra">I hope this helps. Let me know if you can't get this working on your end.<br><br></div><div class="gmail_extra">- Mark<br></div></div>