]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
enleve print intempestif
authorPASCALE NOYRET <pascale.noyret@edf.fr>
Mon, 30 May 2022 09:58:35 +0000 (11:58 +0200)
committerPASCALE NOYRET <pascale.noyret@edf.fr>
Mon, 30 May 2022 09:58:35 +0000 (11:58 +0200)
generator/generator_python.py

index 22399eebff3587ff2dc3e01f4f36f26c1f9d88ae..e48832cb08a1138bc679f44c554ace008a637c05 100644 (file)
@@ -89,9 +89,11 @@ class PythonGenerator(object):
         self.appliEficas=None
 
     def writeFile(self,filename):
-        fp=open(filename,'w')
-        fp.write(self.text)
-        fp.close()
+        try : 
+            with open(filename, "w") as fp:
+                fp.write(self.text)
+                return 1
+        except : return 0
 
     def gener(self,obj,format='brut',config=None,appliEficas=None):
         """
@@ -103,7 +105,7 @@ class PythonGenerator(object):
         """
         import logging
         if obj == None :
-            print ('appel a gener avec None')
+            #print ('appel a gener avec None')
             return
         self.appliEficas=appliEficas
         liste= self.generator(obj)