changeset 815:4a52878d1ddc

model file writing error for DAA input groups
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Mon, 17 Aug 2009 15:40:57 -0400
parents 90b50bd79bc0
children d1e6c36df023
files pylearn/algorithms/sandbox/DAA_inputs_groups.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Fri Aug 14 19:19:30 2009 -0400
+++ b/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Mon Aug 17 15:40:57 2009 -0400
@@ -20,7 +20,13 @@
     print 'save ndarray to file: ', save_dir + fname
     file_handle = open(os.path.join(save_dir, fname), 'w')
     filetensor.write(file_handle, mat)
-    file_handle.close()
+    writebool = False
+    while not writebool:
+        try:
+            file_handle.close()
+            writebool = True
+        except:
+            print 'save model error'
 
 def load_mat(fname, save_dir=''):
     print 'loading ndarray from file: ', save_dir + fname