Message8305

Author aryeh
Recipients aryeh
Date 2014-04-24.14:25:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398349536.52.0.846946964179.issue2131@psf.upfronthosting.co.za>
In-reply-to
Content
The attached script produces an error which I reported on the ImageJ mailing list.

Here is what I wrote there:

I have the following snippet in my code, designed to create an output directory if it does not already exist:

91 outDir = os.path.join(inputDir,"zPlots/")
92 print outDir
93 if not os.path.exists(outDir):
94     os.makedirs(outDir)


If the directory exists, this runs ok. If I skip line 93 and make the directory withotu checking,

If the directory does not exist, it produces an error.

File "<iostream>", line 93, in <module>
File "/Applications/local/fiji/Fiji.app/jars/jython-2.7-bl.jar /Lib/posixpath.py", line 171, in exists
File "/Applications/local/fiji/Fiji.app/jars/jython-2.7-bl.jar /Lib/posixpath.py", line 171, in exists
java.lang.AbstractMethodError: org.python.modules.posix.PythonPOSIXHandler.error(Ljnr/constants/platform/Errno;Ljava/lang/String;)V
    at jnr.posix.BaseNativePOSIX.stat(BaseNativePOSIX.java:309)

There is these a long list of at jnr.posix ... and org.posix.... etc , which I have not copied.
(BTW -- is there a way to copy the text from the error display of the Fiji script editor?)

I also tried

outDir = inputDir + "zPlots/"

with the same problem.

I tried also to use try and except on this.
except AbstractMethodError seems to catch this.
I suppose I could catch any failure and assume that the directory exists, but this does not seem the correct
way to do this.
History
Date User Action Args
2014-04-24 14:25:36aryehsetrecipients: + aryeh
2014-04-24 14:25:36aryehsetmessageid: <1398349536.52.0.846946964179.issue2131@psf.upfronthosting.co.za>
2014-04-24 14:25:36aryehlinkissue2131 messages
2014-04-24 14:25:36aryehcreate