diff --git a/zUtil_Python/dct_compile_matlab_functions.py b/zUtil_Python/dct_compile_matlab_functions.py
index f7be78c3816c316afc1e088be8b4910aa4f44e2e..10b17fc574f67e0a1553fb5a0bc1fdca07f4cea9 100755
--- a/zUtil_Python/dct_compile_matlab_functions.py
+++ b/zUtil_Python/dct_compile_matlab_functions.py
@@ -148,9 +148,13 @@ class FunctionsBuilder(object):
 
         script_loc = os.path.join(self.script_dir, 'compile.m')
         self.out.printSubJob("Writing '%s' script to disk.." % script_loc)
-        fid = open(script_loc, "w")
-        fid.writelines(script_content)
-        fid.close()
+        try:
+            fid = open(script_loc, "w")
+            fid.writelines(script_content)
+            fid.close()
+        except IOError as ex:
+            DCTOutput.printWarning("Impossible to write script file: '%s'" % script_loc)
+            print(ex)
 
     def compileFuncs(self):
         if not os.path.exists(self.bin_dir):