Salome HOME
Python wrapping of MEDFileMesh.ConvertFromMEDFileGeoType
[tools/medcoupling.git] / src / MEDLoader / Swig / medutilities.py
index adf51ce0bdc506dae21fc69912b5301249d2c17b..c9af7dbb083946d5040647c4fec2f301bda91029 100644 (file)
@@ -1,11 +1,11 @@
 # -*- coding: iso-8859-1 -*-
 # --
-# Copyright (C) 2009-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2009-2020  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 from MEDLoader import *
 
+def my_remove(f):
+    from os import remove
+    try:
+        remove(f)
+    except OSError:
+        pass
+    return
+
 def convert(file_in, driver_in, driver_out, format=1, file_out=None):
     #
-    print file_in
+    print(file_in)
     #
     if file_out is None:
         file_out = file_in
@@ -37,7 +45,7 @@ def convert(file_in, driver_in, driver_out, format=1, file_out=None):
             msg = "Driver out %s is unknown"%(driver_out)
             raise NotImplementedError(msg)
         pass
-    print file_out
+    print(file_out)
     #
     if driver_in == "GIBI":
         sr = SauvReader.New(file_in)
@@ -56,6 +64,8 @@ def convert(file_in, driver_in, driver_out, format=1, file_out=None):
         sw.setMEDFileDS(mfd,0);#0 ?
         sw.write(file_out)
         #
+        mesh = mfd.getMeshes()[0]
+        mesh_dim = mesh.getSpaceDimension()
         if mesh_dim >= 3:
             from sys import platform
             if platform in ["win32"]: