The following code works fine on my desktop version of python (2.7) but
it does not work using the ImageJ/Fiji code editor (which I believe is using python 2.5.2) dirRawIn = os.path.join(dirBase, dirRaw) dirAnlOut = os.path.join(dirBase, dirAnl) dirMntOut = os.path.join(dirBase, dirMnt) def mkdir_p(path): print path try: os.makedirs(path) except OSError, exc: if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise mkdir_p(dirAnlOut) mkdir_p(dirMntOut) I'm pretty sure everything I've read suggests that code should work even on python 2.5. Does anyone have any ideas why this code doesn't work within Fiji? I just get a huge block of Traceback error text that doesn't give me any real information. I can post if it is needed. Thanks -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Daniel, I had problems with Jython in Fiji that were solved with the advice of Brian Northan (see below, the discussions was started in this list around May 6 2014 with "new error in python script" subject). You need also import each python and ImageJ class. Hope it helps...
> Hi Leon I got the same thing. I believe it is because of a conflict between components packaged with both jython and jruby. jruby was updated recently. When I deleted ruby-complete-1.7.11.jar from the jars directory the jython scripts started working again. This is a hack though because then jruby doesn't work. Brian > All the best, Leon Le 7 juil. 2014 à 23:01, J. Daniel Fenn a écrit : > The following code works fine on my desktop version of python (2.7) but > it does not work using the ImageJ/Fiji code editor (which I believe is > using python 2.5.2) > > > dirRawIn = os.path.join(dirBase, dirRaw) > dirAnlOut = os.path.join(dirBase, dirAnl) > dirMntOut = os.path.join(dirBase, dirMnt) > > def mkdir_p(path): > print path > try: > os.makedirs(path) > except OSError, exc: > if exc.errno == errno.EEXIST and os.path.isdir(path): > pass > else: > raise > > mkdir_p(dirAnlOut) > mkdir_p(dirMntOut) > > > I'm pretty sure everything I've read suggests that code should work even > on python 2.5. Does anyone have any ideas why this code doesn't work > within Fiji? > > I just get a huge block of Traceback error text that doesn't give me any > real information. I can post if it is needed. > > Thanks > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by J. Daniel Fenn
Hi,
I don't try directly your code, but I use os in my jython script. I think that could be a problem of ImageJ 2/Fiji; because i can run my script with last imagej 1 version using FIJI script editor, but they don't work if I update to ImageJ2. So maybe you can try to run your script a ImageJ1 version. Have a nice day, Emanuele Martini Image Analys @ifom-ieo ressearch campus
Image Analyst @Ifom-IEO research campus -MI-
|
Hi everyone,
> The following code works fine on my desktop version of python (2.7) > but it does not work using the ImageJ/Fiji code editor (which I > believe is using python 2.5.2) This bug is being tracked at: https://github.com/fiji/fiji/issues/83 As a workaround, you can delete jffi-1.2.7jar and Jython will work again. I figured this out as follows: * Plugins > Utilities > Find Jar for Class * Paste name of problematic class from the exception: com.kenai.jffi.InvocationBuffer * Click OK * Note the warning that appears about how the class is present in two different locations. Regards, Curtis On Tue, Jul 8, 2014 at 4:38 AM, Emanuele Martini <[hidden email]> wrote: > Hi, > I don't try directly your code, but I use os in my jython script. > I think that could be a problem of ImageJ 2/Fiji; because i can run my > script with last imagej 1 version using FIJI script editor, but they don't > work if I update to ImageJ2. > > So maybe you can try to run your script a ImageJ1 version. > Have a nice day, > Emanuele Martini > Image Analys @ifom-ieo ressearch campus > > > > -- > View this message in context: > http://imagej.1557.x6.nabble.com/Python-Jython-code-that-doesn-t-work-in-ImageJ-tp5008609p5008619.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |