Re: import os no longer working in .py files?

Posted by Aryeh Weiss on
URL: http://imagej.273.s1.nabble.com/import-os-no-longer-working-in-py-files-tp5009213p5009215.html

On 8/14/14, 9:08 PM, Snider, Kaitlin wrote:
> I updated today (first time in about a week) and immediately thereafter realized my "batch" macros are broken.  I use .py macros to extract file names to run a function on all of the image files in a folder, and this requrires "import os."  "import os" no longer finds an os module.  Is this deleted and needs replaced?  If so, where can I find it and where does it go?  Or is this a change in IJ2 that no longer allows os-module python macros?  If that's the case, any great sample batch macros in the IJ Macro language that you could refer me to?
>
> Thanks very much :)
>
> Kaitlin Snider
>
>

See bug 890:
http://fiji.sc/bugzilla/show_bug.cgi?id=890

Here is my workaround:

You can work around this by downloading the Jython 2.5.2 distribution,
unzipping
the downloaded distribution, and copying the Lib/ directory to the Fiji
jars/ directory. Then your python will find os and will work.

I found that I could not do this with Jython 2.5.3. If you use 2.5.3, it
will find os, but it will report an error having to do with a feature
that is not compatible with your Jython. I do not remember exactly what
it was, because I no longer have the 2.5.3 Jython on my computer.

--aryeh

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html