diff jython_script.py @ 2:c8fc3f34cbff draft

planemo upload commit 8f8692e83217a072a3ed928469621f1f606ab28a-dirty
author iuc
date Tue, 04 Aug 2015 11:15:16 -0400
parents da9a450c85b7
children d99cf938ad41
line wrap: on
line diff
--- a/jython_script.py	Fri Jun 26 05:28:29 2015 -0400
+++ b/jython_script.py	Tue Aug 04 11:15:16 2015 -0400
@@ -1,11 +1,7 @@
 import sys
 from ij import IJ
 from ij import ImagePlus
-
-def handle_error( error_log, msg ):
-    elh = open( error_log, 'wb' )
-    elh.write( msg )
-    elh.close()
+import jython_utils
 
 # Fiji Jython interpreter implements Python 2.5 which does not
 # provide support for argparse.
@@ -62,14 +58,14 @@
         # we'll be able to write tool validators rather than having to stop the job in
         # an error state.
         msg = "Remove NaNs requires a 32-bit image, the selected image is %d-bit" % bit_depth
-        handle_error( error_log, msg )
+        jython_utils.handle_error( error_log, msg )
         error = True
 elif noise == 'rof_denoise':
     if image_type == ImagePlus.GRAY32:
         IJ.run( image_plus_copy, "ROF Denoise", "" )
     else:
         msg = "ROF Denoise requires an image of type 32-bit grayscale, the selected image is %d-bit" % ( bit_depth )
-        handle_error( error_log, msg )
+        jython_utils.handle_error( error_log, msg )
         error = True
 elif noise == 'randomj':
     if randomj == 'randomj_binomial':