Salome HOME
Passage vers python 3
authorGerald NICOLAS <gerald.nicolas@edf.fr>
Thu, 5 Oct 2017 11:15:25 +0000 (13:15 +0200)
committerGerald NICOLAS <gerald.nicolas@edf.fr>
Thu, 5 Oct 2017 11:15:25 +0000 (13:15 +0200)
src/tests/Test/test_1.py
src/tests/Test/test_2.py
src/tests/Test/test_3.py
src/tests/Test/test_4.py
src/tests/Test/test_5.py
src/tests/Test/test_util.py
src/tests/Test/tutorial_1.py
src/tests/Test/tutorial_2.py
src/tests/Test/tutorial_3.py
src/tests/Test/tutorial_4.py
src/tests/Test/tutorial_5.py

index 2bb3ca2666e754c0c1ce38f91964e173d03bed95..dd221ebc8816a4fcb94ddfaa1cd899004d7e7074 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test test_1
 """
-__revision__ = "V3.1"
+__revision__ = "V4.01"
 
 #========================================================================
 TEST_NAME = "test_1"
@@ -87,7 +87,7 @@ Python script for HOMARD
     dico["-1"] = "deraffinement"
   # Creation of the hypothesis a10_1pc_de_mailles_a_raffiner_sur_ERRE_ELEM_SIGM
     hyponame_1 = "a10_1pc_de_mailles_a_raffiner_sur_ERRE_ELEM_SIGM"
-    print "-------- Creation of the hypothesis", hyponame_1
+    print("-------- Creation of the hypothesis", hyponame_1)
     hypo_1_1 = HOMARD.CreateHypothesis(hyponame_1)
     hypo_1_1.SetField('RESU____ERRE_ELEM_SIGM__________')
     hypo_1_1.SetUseComp(0)
@@ -95,14 +95,14 @@ Python script for HOMARD
     hypo_1_1.SetRefinThr(3, 10.1)
     hypo_1_1.AddFieldInterp('RESU____DEPL____________________')
     hypo_1_1.AddFieldInterp('RESU____ERRE_ELEM_SIGM__________')
-    print hyponame_1, " : champ utilisé :", hypo_1_1.GetFieldName()
-    print hyponame_1, " : composantes utilisées :", hypo_1_1.GetComps()
+    print(hyponame_1, " : champ utilisé :", hypo_1_1.GetFieldName())
+    print(hyponame_1, " : composantes utilisées :", hypo_1_1.GetComps())
     if ( len (hypo_1_1.GetFieldName()) > 0 ) :
-      print ".. caractéristiques de l'adaptation :", hypo_1_1.GetField()
-    print hyponame_1, " : champs interpolés :", hypo_1_1.GetFieldInterps()
+      print(".. caractéristiques de l'adaptation :", hypo_1_1.GetField())
+    print(hyponame_1, " : champs interpolés :", hypo_1_1.GetFieldInterps())
   # Creation of the hypothesis Zones_1_et_2
     hyponame_2 = "Zones_1_et_2"
-    print "-------- Creation of the hypothesis", hyponame_2
+    print("-------- Creation of the hypothesis", hyponame_2)
     zones_1_et_2 = HOMARD.CreateHypothesis(hyponame_2)
     zones_1_et_2.AddZone('Zone_1_1', 1)
     zones_1_et_2.AddZone('Zone_1_2', 1)
@@ -110,17 +110,17 @@ Python script for HOMARD
     nbzone = len(laux)/2
     jaux = 0
     for iaux in range(nbzone) :
-      print hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
+      print(hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
       jaux += 2
-    print hyponame_2, " : champ utilisé :", zones_1_et_2.GetFieldName()
+    print(hyponame_2, " : champ utilisé :", zones_1_et_2.GetFieldName())
     if ( len (zones_1_et_2.GetFieldName()) > 0 ) :
-      print ".. caractéristiques de l'adaptation :", zones_1_et_2.GetField()
-    print hyponame_2, " : champs interpolés :", zones_1_et_2.GetFieldInterps()
+      print(".. caractéristiques de l'adaptation :", zones_1_et_2.GetField())
+    print(hyponame_2, " : champs interpolés :", zones_1_et_2.GetFieldInterps())
   #
   # Creation of the cases
   # =====================
     # Creation of the case
-    print "-------- Creation of the case", TEST_NAME
+    print("-------- Creation of the case", TEST_NAME)
     mesh_file = os.path.join(REP_DATA, TEST_NAME + '.00.med')
     case_test_1 = HOMARD.CreateCase(TEST_NAME, 'MAILL', mesh_file)
     case_test_1.SetDirName(DIRCASE)
@@ -129,17 +129,17 @@ Python script for HOMARD
   # ==========================
   # Creation of the iteration 1
     iter_name = "I_" + TEST_NAME + "_1"
-    print "-------- Creation of the iteration", iter_name
+    print("-------- Creation of the iteration", iter_name)
     iter_test_1_1 = case_test_1.NextIteration(iter_name)
     iter_test_1_1.AssociateHypo(hyponame_1)
-    print ". Hypothese :", hyponame_1
+    print(". Hypothese :", hyponame_1)
     iter_test_1_1.SetMeshName('M1')
     iter_test_1_1.SetMeshFile(os.path.join(DIRCASE, 'maill.01.med'))
     iter_test_1_1.SetFieldFile(os.path.join(REP_DATA, TEST_NAME + '.00.med'))
     iter_test_1_1.SetTimeStepRank(1, 1)
     iter_test_1_1.SetFieldInterpTimeStep('RESU____DEPL____________________', 1)
     iter_test_1_1.SetFieldInterpTimeStepRank('RESU____ERRE_ELEM_SIGM__________', 1, 1)
-    print ". Instants d'interpolation :", iter_test_1_1.GetFieldInterpsTimeStepRank()
+    print(". Instants d'interpolation :", iter_test_1_1.GetFieldInterpsTimeStepRank())
     error = iter_test_1_1.Compute(1, 1)
     if error :
       error = 1
@@ -147,17 +147,17 @@ Python script for HOMARD
 
   # Creation of the iteration 2
     iter_name = "I_" + TEST_NAME + "_2"
-    print "-------- Creation of the iteration", iter_name
+    print("-------- Creation of the iteration", iter_name)
     iter_test_1_2 = iter_test_1_1.NextIteration(iter_name)
     iter_test_1_2.AssociateHypo(hyponame_1)
-    print ". Hypothese :", hyponame_1
+    print(". Hypothese :", hyponame_1)
     iter_test_1_2.SetMeshName('M2')
     iter_test_1_2.SetMeshFile(os.path.join(DIRCASE, 'maill.02.med'))
     iter_test_1_2.SetFieldFile(os.path.join(REP_DATA, TEST_NAME + '.01.med'))
     iter_test_1_2.SetTimeStepRank(1, 1)
     iter_test_1_2.SetFieldInterpTimeStep('RESU____DEPL____________________', 1)
     iter_test_1_2.SetFieldInterpTimeStepRank('RESU____ERRE_ELEM_SIGM__________', 1, 1)
-    print ". Instants d'interpolation :", iter_test_1_2.GetFieldInterpsTimeStepRank()
+    print(". Instants d'interpolation :", iter_test_1_2.GetFieldInterpsTimeStepRank())
     error = iter_test_1_2.Compute(1, 1)
     if error :
       error = 2
@@ -165,14 +165,14 @@ Python script for HOMARD
 
   # Creation of the iteration 3
     iter_name = "I_" + TEST_NAME + "_3"
-    print "-------- Creation of the iteration", iter_name
+    print("-------- Creation of the iteration", iter_name)
     iter_test_1_3 = iter_test_1_2.NextIteration(iter_name)
     iter_test_1_3.AssociateHypo(hyponame_2)
-    print ". Hypothese :", hyponame_2
+    print(". Hypothese :", hyponame_2)
     iter_test_1_3.SetMeshName('M3')
     iter_test_1_3.SetMeshFile(os.path.join(DIRCASE, 'maill.03.med'))
     iter_test_1_2.SetFieldFile(os.path.join(REP_DATA, TEST_NAME + '.02.med'))
-    print ". Instants d'interpolation :", iter_test_1_3.GetFieldInterpsTimeStepRank()
+    print(". Instants d'interpolation :", iter_test_1_3.GetFieldInterpsTimeStepRank())
     error = iter_test_1_3.Compute(1, 1)
     if error :
       error = 3
@@ -205,7 +205,7 @@ try :
   ERROR = homard_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in homard_exec: '+eee.message)
 #
 # Test of the results
index fd92d1f8b7f06daa27110f276829a411e2c01d87..c73f71fa05f519533d1e78445c2d9385f8c481b6 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test test_2
 """
-__revision__ = "V3.1"
+__revision__ = "V4.01"
 
 #========================================================================
 TEST_NAME = "test_2"
@@ -81,28 +81,28 @@ Python script for HOMARD
   # ==========================
   # Creation of the hypothesis 1
     hyponame_1 = "hypo_" + TEST_NAME + "_1"
-    print "-------- Creation of the hypothesis", hyponame_1
+    print("-------- Creation of the hypothesis", hyponame_1)
     hypo_test_2_1 = HOMARD.CreateHypothesis(hyponame_1)
     hypo_test_2_1.SetUnifRefinUnRef(1)
     hypo_test_2_1.AddGroup('EG')
     hypo_test_2_1.AddGroup('BANDE')
-    print hyponame_1, " : zones utilisées :", hypo_test_2_1.GetZones()
-    print hyponame_1, " : champ utilisé :", hypo_test_2_1.GetFieldName()
-    print hyponame_1, " : composantes utilisées :", hypo_test_2_1.GetComps()
+    print(hyponame_1, " : zones utilisées :", hypo_test_2_1.GetZones())
+    print(hyponame_1, " : champ utilisé :", hypo_test_2_1.GetFieldName())
+    print(hyponame_1, " : composantes utilisées :", hypo_test_2_1.GetComps())
     if ( len (hypo_test_2_1.GetFieldName()) > 0 ) :
-      print ".. caractéristiques de l'adaptation :", hypo_test_2_1.GetField()
+      print(".. caractéristiques de l'adaptation :", hypo_test_2_1.GetField())
 
   # Creation of the hypothesis 2
     hyponame_2 = "hypo_" + TEST_NAME + "_2"
-    print "-------- Creation of the hypothesis", hyponame_2
+    print("-------- Creation of the hypothesis", hyponame_2)
     hypo_test_2_2 = HOMARD.CreateHypothesis(hyponame_2)
     hypo_test_2_2.SetUnifRefinUnRef(1)
     hypo_test_2_2.AddGroup('M_D')
-    print hyponame_2, " : zones utilisées :", hypo_test_2_2.GetZones()
-    print hyponame_2, " : champ utilisé :", hypo_test_2_2.GetFieldName()
-    print hyponame_2, " : composantes utilisées :", hypo_test_2_2.GetComps()
+    print(hyponame_2, " : zones utilisées :", hypo_test_2_2.GetZones())
+    print(hyponame_2, " : champ utilisé :", hypo_test_2_2.GetFieldName())
+    print(hyponame_2, " : composantes utilisées :", hypo_test_2_2.GetComps())
     if ( len (hypo_test_2_2.GetFieldName()) > 0 ) :
-      print ".. caractéristiques de l'adaptation :", hypo_test_2_2.GetField()
+      print(".. caractéristiques de l'adaptation :", hypo_test_2_2.GetField())
   #
   # Creation of the cases
   # =====================
@@ -177,7 +177,7 @@ try :
   ERROR = homard_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in homard_exec: '+eee.message)
 #
 # Test of the results
index ddaa7a16b5459767ce21e0accf19ffe839a6b759..04dbec62269a641c4e93217175a7dce91355b5f5 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test test_3
 """
-__revision__ = "V3.1"
+__revision__ = "V4.01"
 
 #========================================================================
 TEST_NAME = "test_3"
@@ -94,21 +94,21 @@ Python script for HOMARD
   # ==========================
   # Uniform refinement
     hyponame = "hypo_" + TEST_NAME
-    print "-------- Creation of the hypothesis", hyponame
+    print("-------- Creation of the hypothesis", hyponame)
     hypo_test_3 = HOMARD.CreateHypothesis(hyponame)
     hypo_test_3.SetUnifRefinUnRef(1)
-    print hyponame, " : zones utilisées :", hypo_test_3.GetZones()
-    print hyponame, " : champ utilisé :", hypo_test_3.GetFieldName()
-    print hyponame, " : composantes utilisées :", hypo_test_3.GetComps()
+    print(hyponame, " : zones utilisées :", hypo_test_3.GetZones())
+    print(hyponame, " : champ utilisé :", hypo_test_3.GetFieldName())
+    print(hyponame, " : composantes utilisées :", hypo_test_3.GetComps())
   #
     for num in range (N_BOUCLE+1) :
   #
-      print "-------- num =", num, "--------"
+      print("-------- num =", num, "--------")
   #
   # Creation of the case case_test_3
   # ===========================
       if ( num <= 1 ) :
-        print "-------- Creation of the case", TEST_NAME
+        print("-------- Creation of the case", TEST_NAME)
         mesh_file = os.path.join(REP_DATA, TEST_NAME + '.00.med')
         case_test_3 = HOMARD.CreateCase(TEST_NAME, 'MOYEU', mesh_file)
         case_test_3.SetDirName(DIRCASE)
@@ -122,7 +122,7 @@ Python script for HOMARD
   # ==========================
   # Creation of the iteration 1
       iter_name = "I_" + TEST_NAME + "_1"
-      print "-------- Creation of the iteration", iter_name
+      print("-------- Creation of the iteration", iter_name)
       iter_test_3_1 = case_test_3.NextIteration(iter_name)
       iter_test_3_1.SetMeshName('MOYEU_1')
       iter_test_3_1.SetMeshFile(os.path.join(DIRCASE, 'maill.01.med'))
@@ -134,7 +134,7 @@ Python script for HOMARD
 
   # Creation of the iteration 2
       iter_name = "I_" + TEST_NAME + "_2"
-      print "-------- Creation of the iteration", iter_name
+      print("-------- Creation of the iteration", iter_name)
       iter_test_3_2 = iter_test_3_1.NextIteration(iter_name)
       iter_test_3_2.SetMeshName('MOYEU_2')
       iter_test_3_2.SetMeshFile(os.path.join(DIRCASE, 'maill.02.med'))
@@ -150,7 +150,7 @@ Python script for HOMARD
       scriptfile = os.path.normpath(scriptfile)
       dirname = DIRCASE
       yacsname = "YACS_" + TEST_NAME
-      print "-------- Creation of the schema", yacsname
+      print("-------- Creation of the schema", yacsname)
       yacs_test_3 = case_test_3.CreateYACSSchema(yacsname, scriptfile, dirname, mesh_file)
       yacs_test_3.SetType(2)
       yacs_test_3.SetMaxIter(2)
@@ -163,7 +163,7 @@ Python script for HOMARD
   # ============
   # Destruction of the schema, sauf a la fin
       if ( num < N_BOUCLE ) :
-        print "-------- Destruction of the schema", yacs_test_3.GetName()
+        print("-------- Destruction of the schema", yacs_test_3.GetName())
         error = yacs_test_3.Delete(1)
         if error :
           error = 10*num + 6
@@ -171,27 +171,27 @@ Python script for HOMARD
   # After the first loop, the case is deleted, except the final mesh files
   # All the iterations are deleted
       if ( num == 0 ) :
-        print "-------- Destruction of the case", case_test_3.GetName()
+        print("-------- Destruction of the case", case_test_3.GetName())
         error = case_test_3.Delete(0)
         if error :
           break
   # After the second loop, the iterations are deleted, with the final mesh files
       elif ( num == 1 ) :
   # Recursive destruction of the iterations
-        print "-------- Recursive destruction of the iteration", iter_test_3_1.GetName()
+        print("-------- Recursive destruction of the iteration", iter_test_3_1.GetName())
         error = iter_test_3_1.Delete(1)
         if error :
           error = 10*num + 3
           break
   # Destruction and creation of the hypothese
         if ( num == 1 ) :
-          print "-------- Destruction of the hypothese", hypo_test_3.GetName()
+          print("-------- Destruction of the hypothese", hypo_test_3.GetName())
           error = hypo_test_3.Delete()
           if error :
             error = 10*num + 4
             break
           hyponame = "hypo_test_3"
-          print "-------- Creation of the hypothesis", hyponame
+          print("-------- Creation of the hypothesis", hyponame)
           hypo_test_3 = HOMARD.CreateHypothesis(hyponame)
           hypo_test_3.SetUnifRefinUnRef(1)
   #
@@ -211,7 +211,7 @@ try :
   ERROR = homard_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in homard_exec: '+eee.message)
 #
 # Test of the results
index e4facd3df597330535f5a2fabdcf4bc6e1cae424..c3d870c24dea815057f53d86caf5c6d39fe34f12 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test test_4
 """
-__revision__ = "V2.2"
+__revision__ = "V3.01"
 
 #========================================================================
 TEST_NAME = "test_4"
@@ -128,7 +128,7 @@ Python script for GEOM and SMESH
     try:
       ficmed = os.path.join(DIRCASE, 'maill.00.med')
       box_m.ExportMED( ficmed, 0, SMESH.MED_V2_2, 1, None, 1)
-    except Exception, eee:
+    except Exception as eee:
       error = 2
       raise Exception('ExportToMEDX() failed. '+eee.message)
   #
@@ -166,7 +166,7 @@ Python script for MEDCoupling
       valeur[iaux] = 1.e0 / max ( 1.e-5, np.sqrt(distance) )
     #print ". valeur", valeur
     nparr = valeur.toNumPyArray()
-    print ". mini/maxi", nparr.min(), nparr.max()
+    print(". mini/maxi", nparr.min(), nparr.max())
   #
   # Creation of the field
   # =====================
@@ -213,7 +213,7 @@ Python script for HOMARD
     dico["-1"] = "deraffinement"
   # Creation of the hypothesis hypo_4_1
     hyponame_1 = "Zone_1"
-    print "-------- Creation of the hypothesis", hyponame_1
+    print("-------- Creation of the hypothesis", hyponame_1)
     hypo_4_1 = HOMARD.CreateHypothesis(hyponame_1)
     hypo_4_1.AddZone('Zone_4_1', 1)
     hypo_4_1.SetExtraOutput(2)
@@ -221,11 +221,11 @@ Python script for HOMARD
     nbzone = len(laux)/2
     jaux = 0
     for iaux in range(nbzone) :
-      print hyponame_1, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
+      print(hyponame_1, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
       jaux += 2
   # Creation of the hypothesis hypo_4_2
     hyponame_2 = "Zone_2"
-    print "-------- Creation of the hypothesis", hyponame_2
+    print("-------- Creation of the hypothesis", hyponame_2)
     hypo_4_2 = HOMARD.CreateHypothesis(hyponame_2)
     hypo_4_2.AddZone('Zone_4_2', 1)
     hypo_4_2.SetExtraOutput(2)
@@ -233,11 +233,11 @@ Python script for HOMARD
     nbzone = len(laux)/2
     jaux = 0
     for iaux in range(nbzone) :
-      print hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
+      print(hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
       jaux += 2
   # Creation of the hypothesis DISTANCE INVERSE
     hyponame_3 = "DISTANCE INVERSE"
-    print "-------- Creation of the hypothesis", hyponame_3
+    print("-------- Creation of the hypothesis", hyponame_3)
     hypo_4_3 = HOMARD.CreateHypothesis(hyponame_3)
     hypo_4_3.SetField('DISTANCE')
     hypo_4_3.SetUseComp(0)
@@ -245,17 +245,17 @@ Python script for HOMARD
     hypo_4_3.SetUnRefThr(1, 0.2)
     hypo_4_3.AddFieldInterp('DISTANCE')
     hypo_4_3.SetExtraOutput(2)
-    print hyponame_3, " : zones utilisées :", hypo_4_3.GetZones()
-    print hyponame_3, " : champ utilisé :", hypo_4_3.GetFieldName()
-    print hyponame_3, " : composantes utilisées :", hypo_4_3.GetComps()
+    print(hyponame_3, " : zones utilisées :", hypo_4_3.GetZones())
+    print(hyponame_3, " : champ utilisé :", hypo_4_3.GetFieldName())
+    print(hyponame_3, " : composantes utilisées :", hypo_4_3.GetComps())
     if ( len (hypo_4_3.GetFieldName()) > 0 ) :
-      print ".. caractéristiques de l'adaptation :", hypo_4_3.GetField()
-    print hyponame_3, " : champs interpolés :", hypo_4_3.GetFieldInterps()
+      print(".. caractéristiques de l'adaptation :", hypo_4_3.GetField())
+    print(hyponame_3, " : champs interpolés :", hypo_4_3.GetFieldInterps())
   #
   # Creation of the cases
   # =====================
     # Creation of the case
-    print "-------- Creation of the case", TEST_NAME
+    print("-------- Creation of the case", TEST_NAME)
     mesh_file = os.path.join(DIRCASE, 'maill.00.med')
     case_test_4 = HOMARD.CreateCase(TEST_NAME, 'MESH', mesh_file)
     case_test_4.SetDirName(DIRCASE)
@@ -264,10 +264,10 @@ Python script for HOMARD
   # ==========================
   # Creation of the iteration 1
     iter_name = "I_" + TEST_NAME + "_1"
-    print "-------- Creation of the iteration", iter_name
+    print("-------- Creation of the iteration", iter_name)
     iter_test_4_1 = case_test_4.NextIteration(iter_name)
     iter_test_4_1.AssociateHypo(hyponame_1)
-    print ". Hypothese :", hyponame_1
+    print(". Hypothese :", hyponame_1)
     iter_test_4_1.SetMeshName('M1')
     iter_test_4_1.SetMeshFile(os.path.join(DIRCASE, 'maill.01.med'))
     error = iter_test_4_1.Compute(1, 2)
@@ -277,10 +277,10 @@ Python script for HOMARD
 
   # Creation of the iteration 2
     iter_name = "I_" + TEST_NAME + "_2"
-    print "-------- Creation of the iteration", iter_name
+    print("-------- Creation of the iteration", iter_name)
     iter_test_4_2 = iter_test_4_1.NextIteration(iter_name)
     iter_test_4_2.AssociateHypo(hyponame_2)
-    print ". Hypothese :", hyponame_2
+    print(". Hypothese :", hyponame_2)
     iter_test_4_2.SetMeshName('M2')
     iter_test_4_2.SetMeshFile(os.path.join(DIRCASE, 'maill.02.med'))
     error = iter_test_4_2.Compute(1, 2)
@@ -296,10 +296,10 @@ Python script for HOMARD
       break
   #
     iter_name = "I_" + TEST_NAME + "_3"
-    print "-------- Creation of the iteration", iter_name
+    print("-------- Creation of the iteration", iter_name)
     iter_test_4_3 = iter_test_4_2.NextIteration(iter_name)
     iter_test_4_3.AssociateHypo(hyponame_3)
-    print ". Hypothese :", hyponame_3
+    print(". Hypothese :", hyponame_3)
     iter_test_4_3.SetMeshName('M3')
     iter_test_4_3.SetFieldFile(os.path.join(DIRCASE, 'maill.02.med'))
     iter_test_4_3.SetMeshFile(os.path.join(DIRCASE, 'maill.03.med'))
@@ -320,7 +320,7 @@ try :
   ERROR = geom_smesh_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in geom_smesh_exec')
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in geom_smesh_exec: '+eee.message)
 
 HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
@@ -333,7 +333,7 @@ try :
   ERROR = homard_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in homard_exec: '+eee.message)
 #
 # Test of the results
index 07aa93f30da1a45702e5a72544a577c42a0bded4..1c131ce30f8228857cf7474aa2b32066b10d631a 100755 (executable)
@@ -22,7 +22,7 @@ Python script for HOMARD
 Specific conditions for Code_Saturne
 Test test_5
 """
-__revision__ = "V1.0"
+__revision__ = "V2.01"
 
 #========================================================================
 TEST_NAME = "test_5"
@@ -167,7 +167,7 @@ Python script for MED
       ficmed = os.path.join(DIRCASE, 'maill.00.med')
       #print "Ecriture du maillage dans le fichier", ficmed
       meshMEDFile3D.write(ficmed, 2)
-    except Exception, eee:
+    except Exception as eee:
       error = 2
       raise Exception('ExportToMEDX() failed. '+eee.message)
   #
@@ -214,7 +214,7 @@ Python script for MEDCoupling
       valeur[num_mail] = 1.e0 / max ( 1.e-5, distance)
     #print ". valeur", valeur
     nparr = valeur.toNumPyArray()
-    print ". mini/maxi", nparr.min(), nparr.max()
+    print(". mini/maxi", nparr.min(), nparr.max())
   #
   # Creation of the field
   # =====================
@@ -246,19 +246,19 @@ Python script for HOMARD
   # Creation of the hypothese DISTANCE INVERSE
   # ==========================================
     hyponame = "DISTANCE INVERSE"
-    print "-------- Creation of the hypothesis", hyponame
+    print("-------- Creation of the hypothesis", hyponame)
     hypo_5 = HOMARD.CreateHypothesis(hyponame)
     hypo_5.SetField('DISTANCE')
     hypo_5.SetUseComp(0)
     hypo_5.SetRefinThr(1, 0.020)
     hypo_5.SetUnRefThr(1, 0.015)
-    print hyponame, " : champ utilisé :", hypo_5.GetFieldName()
-    print ".. caractéristiques de l'adaptation :", hypo_5.GetField()
+    print(hyponame, " : champ utilisé :", hypo_5.GetFieldName())
+    print(".. caractéristiques de l'adaptation :", hypo_5.GetField())
   #
   # Creation of the cases
   # =====================
     # Creation of the case
-    print "-------- Creation of the case", TEST_NAME
+    print("-------- Creation of the case", TEST_NAME)
     mesh_file = os.path.join(DIRCASE, 'maill.00.med')
     case_test_5 = HOMARD.CreateCase(TEST_NAME, 'MESH', mesh_file)
     case_test_5.SetDirName(DIRCASE)
@@ -282,7 +282,7 @@ Python script for HOMARD
     # Creation of the iteration
     #
       iter_name = "I_" + TEST_NAME + "_" + s_niterp1
-      print "-------- Creation of the iteration", iter_name
+      print("-------- Creation of the iteration", iter_name)
       if ( niter == 0 ) :
         iter_test_5 = case_test_5.NextIteration(iter_name)
       else :
@@ -308,7 +308,7 @@ try :
   ERROR = mesh_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in mesh_exec')
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in mesh_exec: '+eee.message)
 
 HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
@@ -321,7 +321,7 @@ try :
   ERROR = homard_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in homard_exec: '+eee.message)
 #
 # Test of the results
index ed11e1f8ebd3aa059fc9273d0334433436fc4122..6fb8c33f1e3d40fbfbd120c1b59562cd3194a248 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Utilitaires pour les tests
 """
-__revision__ = "V2.1"
+__revision__ = "V3.01"
 
 import os
 import MEDLoader as ml
@@ -152,7 +152,7 @@ def saveGeometry( xao_file, name, author="" ):
         break
 
   if not geomObj:
-    raise RuntimeError, "Cant find a geometry object in the SALOME study with name = '%s'" % name
+    raise RuntimeError("Cant find a geometry object in the SALOME study with name = '%s'" % name)
 
   # save the geom object in a XAO file
   l_fields = list()
@@ -179,7 +179,7 @@ Entrées :
     ligne += "\nfic_med_brut = %s" % fic_med_brut
     ligne += "\nfic_med_new  = %s" % fic_med_new
     ligne += "\nxao_file     = %s" % xao_file
-    print ligne
+    print(ligne)
 
   message = ""
   erreur = 0
@@ -233,8 +233,8 @@ Entrées :
     if l_fr :
 #
       if verbose :
-        print "l_fr =", l_fr
-        print "fic_hom_med =", fic_hom_med
+        print("l_fr =", l_fr)
+        print("fic_hom_med =", fic_hom_med)
 #
 # 2.1.  La fonction :
 #    . prend le maillage brut dans le fichier fic_med_brut
@@ -262,7 +262,7 @@ Entrées :
 # 2.3. Ménage de l'ancien fichier MED
 #
       if ( fic_med_brut != fic_med_new ) :
-        print "Suppression du fichier %s" % fic_med_new
+        print("Suppression du fichier %s" % fic_med_new)
         os.remove(fic_med_brut)
 #
 # 3. Renommage du fichier si aucun noeud n'est concerné
@@ -297,7 +297,7 @@ Entrées :
   if verbose :
     ligne =    "rep_calc     = %s" % rep_calc
     ligne += "\nfic_med_calc = %s" % fic_med_calc
-    print ligne
+    print(ligne)
 
   message = ""
   erreur = 0
@@ -356,12 +356,12 @@ Entrées :
 # 3. Mise à jour
 # 3.1. Détermination de l'exécutable
 #
-    if os.environ.has_key("HOMARD_REP_EXE_PRIVATE") :
+    if "HOMARD_REP_EXE_PRIVATE" in os.environ :
       HOMARD_REP_EXE  = os.environ["HOMARD_REP_EXE_PRIVATE"]
     else :
       HOMARD_REP_EXE  = os.environ["HOMARD_REP_EXE"]
 #
-    if os.environ.has_key("HOMARD_EXE_PRIVATE") :
+    if "HOMARD_EXE_PRIVATE" in os.environ :
       HOMARD_EXE  = os.environ["HOMARD_EXE_PRIVATE"]
     else :
       HOMARD_EXE  = os.environ["HOMARD_EXE"]
@@ -369,7 +369,7 @@ Entrées :
     homard_exe = os.path.join(HOMARD_REP_EXE, HOMARD_EXE)
     if verbose :
       ligne = "homard_exe = %s" % homard_exe
-      print ligne
+      print(ligne)
 #
     if not os.path.isfile(homard_exe) :
       message = "homard_exe = %s" % homard_exe
index 201490bfbafad641db509902d019c24e21cd2b96..b227bd2aba1bf6729694a831689b040bdf2bb48f 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_1 associe au tutorial 1
 """
-__revision__ = "V3.1"
+__revision__ = "V4.01"
 
 #========================================================================
 TEST_NAME = "tutorial_1"
@@ -123,7 +123,7 @@ try :
   ERROR = homard_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in homard_exec: '+eee.message)
 #
 # Test of the results
index ee9802de4205a26e2b4ce71d6698f5ec322b15f6..ca731ac5cc17f648e40c370563e38bbf82f16817 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_2 associe au tutorial 2
 """
-__revision__ = "V3.1"
+__revision__ = "V4.01"
 
 #========================================================================
 TEST_NAME = "tutorial_2"
@@ -134,7 +134,7 @@ try :
   ERROR = homard_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in homard_exec: '+eee.message)
 #
 # Test of the results
index 8a043061f7c21190edcb476c877051c8898255de..c4efe620b192392d47444b2cfc04920b0e372729 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_3 associe au tutorial 3
 """
-__revision__ = "V3.1"
+__revision__ = "V4.01"
 
 #========================================================================
 TEST_NAME = "tutorial_3"
@@ -163,7 +163,7 @@ try :
   ERROR = homard_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in homard_exec: '+eee.message)
 #
 # Test of the results
index 676b2876cfc648fb15eda9f3b9964cb55fa89ea7..3816780d7a7463eebfc0ca1089817dd05869e22b 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_4 associe au tutorial 4
 """
-__revision__ = "V3.1"
+__revision__ = "V4.01"
 
 #========================================================================
 TEST_NAME = "tutorial_4"
@@ -150,7 +150,7 @@ try :
   ERROR = homard_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in homard_exec: '+eee.message)
 #
 # Test of the results
index c79201f0422dcf4475959fda3a65f8927032c8cd..1ffd27205d3d8ef20a3bc9ed840afc041e4e93eb 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_5 associe au tutorial 5
 """
-__revision__ = "V3.1"
+__revision__ = "V4.01"
 
 #========================================================================
 TEST_NAME = "tutorial_5"
@@ -134,7 +134,7 @@ try :
   ERROR = homard_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
   raise Exception('Pb in homard_exec: '+eee.message)
 #
 # Test of the results