Salome HOME
Merge branch 'master' into V9_dev
[modules/kernel.git] / src / KERNEL_PY / kernel / services.py
index b1b3db9c1e21276e9bf9943b3b9a8e1bb499e546..e14023b7e84afbae17d12aebe9fde18408c7ce7b 100644 (file)
 # SALOME development).
 
 import salome
-from deprecation import is_called_by_sphinx
+from .deprecation import is_called_by_sphinx
 if not is_called_by_sphinx() and salome.lcc is None:
     try:
         salome.salome_init()
-    except Exception, e:
-        print e
+    except Exception as e:
+        print(e)
 
 # Note that the salome module provides you with standard SALOME
 # objects: CORBA broker (orb): salome.orb lyfe cycle (lcc) :
@@ -96,12 +96,12 @@ def getComponent(componentName = "SalomeTestComponent",
     """
     Get a SALOME CORBA component from its name
     """
-    print "INF: getting component %s from CORBA module %s ..."%(componentName,corbaModule)
+    print("INF: getting component %s from CORBA module %s ..."%(componentName,corbaModule))
     __import__(corbaModule)
     component=salome.lcc.FindOrLoadComponent(containerType,componentName)
     if component is None:
-        print "ERR: the SALOME component "+componentName+" can't be reached"
-    print "INF: component %s obtained from CORBA module %s"%(componentName,corbaModule)
+        print("ERR: the SALOME component "+componentName+" can't be reached")
+    print("INF: component %s obtained from CORBA module %s"%(componentName,corbaModule))
     return component
 
 # Note that an alternative (and maybe better) method to get a component
@@ -120,7 +120,7 @@ def getComponentList():
     obj = salome.naming_service.Resolve('Kernel/ModulCatalog')
     catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
     if not catalog:
-        raise RuntimeError, "Can't accesss module catalog"
+        raise RuntimeError("Can't accesss module catalog")
     return catalog.GetComponentList()
 
 import SALOMEDS
@@ -236,7 +236,7 @@ def TEST_createObject():
     """
     import GEOM
     from salome.geom import geomBuilder
-    geompy = geomBuilder.New(salome.myStudy)
+    geompy = geomBuilder.New()
 
     box = geompy.MakeBoxDXDYDZ(200, 200, 200)
     id = geompy.addToStudy( box, 'box' )
@@ -253,14 +253,14 @@ def TEST_objectsManipulation():
 
 
     myObject = IDToObject(myEntry)
-    print myObject
+    print(myObject)
     if myObject is None:
         return False
 
     return True
 
 if __name__ == "__main__":
-    import unittester
+    from . import unittester
     unittester.run("services","TEST_getComponent")
     unittester.run("services","TEST_getComponentList")
     unittester.run("services","TEST_objectsManipulation")