]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Merge Python 3 porting.
authorrnv <rnv@opencascade.com>
Thu, 22 Jun 2017 14:28:12 +0000 (17:28 +0300)
committerrnv <rnv@opencascade.com>
Fri, 23 Jun 2017 08:17:13 +0000 (11:17 +0300)
46 files changed:
1  2 
bin/appliskel/salome_tester/salome_instance.py
bin/appliskel/salome_tester/salome_test_driver.py
bin/appliskel/tests/concurrentSession/TestMinimalExample.py
bin/nameserver.py
bin/runConsole.py
bin/runSalome.py
bin/runSession.py
bin/salomeContext.py
bin/salome_utils.py
doc/salome/examples/example1
doc/salome/examples/example12
doc/salome/examples/example13
doc/salome/examples/example14
doc/salome/examples/example15
doc/salome/examples/example16
doc/salome/examples/example19
doc/salome/examples/example20
doc/salome/examples/example21
doc/salome/examples/example22
doc/salome/examples/example3
doc/salome/examples/example4
doc/salome/examples/example5
doc/salome/kernel_salome.dox
src/Container/Container_i.cxx
src/Container/SALOME_ComponentPy.py
src/Container/SALOME_Container.py
src/Container/SALOME_ContainerPy.py
src/KERNEL_PY/Help.py
src/KERNEL_PY/PyInterp.py
src/KERNEL_PY/__init__.py
src/KERNEL_PY/batchmode_salome.py
src/KERNEL_PY/kernel/parametric/study_exchange_vars.py
src/KERNEL_PY/kernel/services.py
src/KERNEL_PY/kernel/studyedit.py
src/KERNEL_PY/salome_ComponentGUI.py
src/KERNEL_PY/salome_iapp.py
src/KERNEL_PY/salome_notebook.py
src/KERNEL_PY/salome_study.py
src/KERNEL_PY/salome_test.py
src/Launcher/Test/test_launcher.py
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/MPIContainer/MPIContainer_i.cxx
src/ModuleGenerator/IDLparser.py
src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx
src/ParallelContainer/SALOME_ParallelContainer_i.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx

index 4498d6934cd86da8c1ab721c93339d270745c073,713f3ad96f9c40368f3616e925a6bd4dec479a2f..9771f9a2722202f5b4fe7a3a2467003007a83fad
@@@ -73,8 -73,8 +73,8 @@@ class TestMinimalExample(unittest.TestC
      p.join()
  
      # Release port
-     print "release port 2899"
 -    print("release port 2812")
 -    p = multiprocessing.Process(target=releasePort, args=(2812,))
++    print ("release port 2899")
 +    p = multiprocessing.Process(target=releasePort, args=(2899,))
      p.start()
      p.join()
  
index 37061547ded443e8d1d94640695eb31972d94d6f,37cbdbf6b6df6f48e490c0e07af9dd8c193ccc94..19fde8e96bf6f3062ba9aff671e2474bba680509
@@@ -46,8 -46,13 +46,8 @@@ class NamingServer(Server)
          except:
              pass
  
-         if verbose(): print "Name Service... "
 -        if verbose(): print("Name Service... ", end=' ')
 -        #hname=os.environ["HOST"] #commands.getoutput("hostname")
 -        if sys.platform == "win32":
 -          hname = getShortHostName();
 -        else:
 -          hname = socket.gethostname();
 -        # print("hname=",hname)
++        if verbose(): print("Name Service... ", end =' ')
 +        hname = getHostName()
  
          with open(os.environ["OMNIORB_CONFIG"]) as f:
            ss = re.findall("NameService=corbaname::" + hname + ":\d+", f.read())
Simple merge
Simple merge
Simple merge
index 69116a8c8be3abf4ea8c5aadb9a715a97ce65e8d,4f31c584f726445e600e30b5d9b599fd1ade3f15..8a78e1442f586de5bd0e0ed0e15f9dc88043e757
@@@ -260,19 -262,19 +262,19 @@@ class SalomeContext
  
      try:
        res = getattr(self, command)(options) # run appropriate method
 -      return res or (None, None)
 +      return res or 0
-     except SystemExit, returncode:
+     except SystemExit as returncode:
        if returncode != 0:
 -        self.getLogger().warning("SystemExit %s in method %s.", returncode, command)
 +        self.getLogger().error("SystemExit %s in method %s.", returncode, command)
        return returncode
-     except StandardError:
 -    except SalomeContextException as e:
 -      self.getLogger().error(e)
 -      return 1
+     except Exception:
        self.getLogger().error("Unexpected error:")
        import traceback
        traceback.print_exc()
        return 1
-     except SalomeContextException, e:
++    except SalomeContextException as e:
 +      self.getLogger().error(e)
 +      return 1
    #
  
    def __setContextFromConfigFile(self, filename, reserved=None):
@@@ -613,11 -615,10 +615,11 @@@ Available options are
  
  if __name__ == "__main__":
    if len(sys.argv) == 3:
-     context = pickle.loads(sys.argv[1])
-     args = pickle.loads(sys.argv[2])
+     context = pickle.loads(sys.argv[1].encode())
+     args = pickle.loads(sys.argv[2].encode())
  
 -    context._startSalome(args)
 +    status = context._startSalome(args)
 +    sys.exit(status)
    else:
      usage()
  #
Simple merge
index 7092166104ae149b2644627185d3e1b6df6bc290,a7d937fdbac2775b58d82ffd4858888c7d938692..9300f476eef7e8eec7bc085ebf2316ed53515553
@@@ -19,10 -19,10 +19,10 @@@ file = str+"/test.hdf
  
  #file = "/tmp/ggg.hdf"
  
- print " -------  We will save to", file, "-----------"
+ print(" -------  We will save to", file, "-----------")
  
 -batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
 -openedStudy=batchmode_geompy.myStudyManager.Open(file)
 +batchmode_geompy.myStudy.SaveAs(file)
 +openedStudy=batchmode_geompy.myStudy.Open(file)
  
  if openedStudy == None:
          raise  RuntimeError, "Can't open saved study!"
Simple merge
Simple merge
Simple merge
Simple merge
index 724fb89fd4707fc82c0980ab866027b460293155,d05c9a83c494928b6f56289da234cbdd09d05980..b5694d661bc6d922fcd81901ab4c1d746681dd3c
@@@ -100,11 -100,11 +100,11 @@@ if res == 0 or A == None
  A = A._narrow(SALOMEDS.AttributeSequenceOfInteger)
  
  if A.Length() != 4:
-         print "Wrong length of SequenceOfInteger"
+         print("Wrong length of SequenceOfInteger")
  if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) != 500:
-         print "Wrong  value of  AttributeSequenceOfInteger"
+         print("Wrong  value of  AttributeSequenceOfInteger")
  #----------------------------------------------------------------------
 -openedStudy=batchmode_geompy.myStudyManager.Open(file2);
 +openedStudy=batchmode_geompy.myStudy.Open(file2);
  
  if openedStudy == None:
          raise  RuntimeError, "Can't open saved study!"
index dbbd80e523d1873a177a207afb19be05910cd5d6,71efad3612cff236c1226b8bd5c109ba99c94a2c..1a60f7df8dbd20054898def20c83b33147ad9c1f
@@@ -70,53 -70,53 +70,53 @@@ batchmode_smesh.SetShape(idbox, idmesh)
  
  # ---- create Hypothesis
  
- print "-------------------------- create Hypothesis ----------------------"
- print "-------------------------- LocalLength"
+ print("-------------------------- create Hypothesis ----------------------")
+ print("-------------------------- LocalLength")
 -hyp1 = smesh.CreateHypothesis("LocalLength", batchmode_geompy.myStudyId )
 +hyp1 = smesh.CreateHypothesis("LocalLength")
  hypLen1 = hyp1._narrow(SMESH.SMESH_LocalLength)
  hypLen1.SetLength(100)
- print hypLen1.GetName()
- print hypLen1.GetId()
- print hypLen1.GetLength()
+ print(hypLen1.GetName())
+ print(hypLen1.GetId())
+ print(hypLen1.GetLength())
  
  idlength = batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypLen1) );
  batchmode_smesh.SetName(idlength, "Local_Length_100");
  
- print "-------------------------- NumberOfSegments"
+ print("-------------------------- NumberOfSegments")
 -hyp2 =  smesh.CreateHypothesis("NumberOfSegments", batchmode_geompy.myStudyId )
 +hyp2 =  smesh.CreateHypothesis("NumberOfSegments")
  hypNbSeg1=hyp2._narrow(SMESH.SMESH_NumberOfSegments)
  hypNbSeg1.SetNumberOfSegments(7)
- print hypNbSeg1.GetName()
- print hypNbSeg1.GetId()
- print hypNbSeg1.GetNumberOfSegments()
+ print(hypNbSeg1.GetName())
+ print(hypNbSeg1.GetId())
+ print(hypNbSeg1.GetNumberOfSegments())
  
  idseg =  batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypNbSeg1) );
  batchmode_smesh.SetName(idseg, "NumberOfSegments_7");
  
- print "-------------------------- MaxElementArea"
+ print("-------------------------- MaxElementArea")
 -hyp3 = smesh.CreateHypothesis("MaxElementArea",  batchmode_geompy.myStudyId)
 +hyp3 = smesh.CreateHypothesis("MaxElementArea")
  hypArea1=hyp3._narrow(SMESH.SMESH_MaxElementArea)
  hypArea1.SetMaxElementArea(2500)
- print hypArea1.GetName()
- print hypArea1.GetId()
- print hypArea1.GetMaxElementArea()
+ print(hypArea1.GetName())
+ print(hypArea1.GetId())
+ print(hypArea1.GetMaxElementArea())
  
  idarea1 = batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypArea1) );
  batchmode_smesh.SetName(idarea1, "MaxElementArea_2500");
  
- print "-------------------------- MaxElementArea"
+ print("-------------------------- MaxElementArea")
 -hyp3 = smesh.CreateHypothesis("MaxElementArea",  batchmode_geompy.myStudyId)
 +hyp3 = smesh.CreateHypothesis("MaxElementArea")
  hypArea2 = hyp3._narrow(SMESH.SMESH_MaxElementArea)
  hypArea2.SetMaxElementArea(500)
- print hypArea2.GetName()
- print hypArea2.GetId()
- print hypArea2.GetMaxElementArea()
+ print(hypArea2.GetName())
+ print(hypArea2.GetId())
+ print(hypArea2.GetMaxElementArea())
  
  idarea2 = batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypArea2) );
  batchmode_smesh.SetName(idarea2, "MaxElementArea_500");
  
- print "-------------------------- Regular_1D"
+ print("-------------------------- Regular_1D")
 -alg1 = smesh.CreateHypothesis("Regular_1D",  batchmode_geompy.myStudyId)
 +alg1 = smesh.CreateHypothesis("Regular_1D")
  algo1 = alg1._narrow(SMESH.SMESH_Algo)
  listHyp = algo1.GetCompatibleHypothesis()
  for hyp in listHyp:
@@@ -128,8 -128,8 +128,8 @@@ print(algoReg.GetId()
  idreg = batchmode_smesh.AddNewAlgorithms( orb.object_to_string(algoReg) );
  batchmode_smesh.SetName(idreg, "Regular_1D");
  
- print "-------------------------- MEFISTO_2D"
+ print("-------------------------- MEFISTO_2D")
 -alg2 = smesh.CreateHypothesis("MEFISTO_2D",  batchmode_geompy.myStudyId)
 +alg2 = smesh.CreateHypothesis("MEFISTO_2D")
  algo2 = alg2._narrow(SMESH.SMESH_Algo)
  listHyp=algo2.GetCompatibleHypothesis()
  for hyp in listHyp:
@@@ -326,10 -326,10 +326,10 @@@ file = str+"/test.hdf
  #==================================================
  #1. SaveAs
  #==================================================
- print " -------  We will save to", file, "-----------"
+ print(" -------  We will save to", file, "-----------")
  
 -batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
 -batchmode_geompy.myStudyManager.Close(batchmode_geompy.myStudy)
 +batchmode_geompy.myStudy.SaveAs(file)
 +batchmode_geompy.myStudy.Clear()
  
  #rename the file and try to reread it again
  
@@@ -342,10 -342,10 +342,10 @@@ os.rename(file, str+"/test_dir/test_new
  #==================================================
  #3. Open
  #==================================================
- print " ------- We try to open " + str + "/test_dir/test_new.hdf"
+ print(" ------- We try to open " + str + "/test_dir/test_new.hdf")
  
  try:
 -        openedStudy=batchmode_geompy.myStudyManager.Open(str+"/test_dir/test_new.hdf")
 +        openedStudy=batchmode_geompy.myStudy.Open(str+"/test_dir/test_new.hdf")
  except Exception:
          raise  RuntimeError, "Can't open saved study!"
  
index 20affe6dcc6c4b84a13a845d64a90110582dfdc6,64ff48f3653c0034e0c166f64b6d6663f1fceabc..6b7731d99c662f4d9e4d9d9fabcda48c30092bd8
@@@ -63,9 -63,9 +63,9 @@@ if str == None
          str = "/tmp"
  file = str+"/test.hdf"
  
- print " -------  We will save to", file, "-----------"
+ print(" -------  We will save to", file, "-----------")
  
 -batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
 +batchmode_geompy.myStudy.SaveAs(file)
  
  
  #--------------------------------------------------------------------------#
index 9d456d04bb206910e6ebe8bb6819d8bc3dc2054b,6c9dd9783f53ba07c697486fb4fb4adf0fc12ec0..7ff5b0ec2e5bfab3539ec849f52f8f0bacde9045
@@@ -77,9 -77,9 +77,9 @@@ if str == None
          str = "/tmp"
  file = str+"/test.hdf"
  
- print " -------  We will save to", file, "-----------"
+ print(" -------  We will save to", file, "-----------")
  
 -batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
 +batchmode_geompy.myStudy.SaveAs(file)
  
  #--------------------------------------------------------------------------#
  #---------------------------- Open file -----------------------------------# 
index 6f9eee0a901a11fb9d127ab6fe51dd83ea1a7b84,84befc2d195539e810ce67774feb342c1b454975..157bd36316637b1fa68646dff663cd1d7e2ee4d2
@@@ -78,9 -78,9 +78,9 @@@ if str == None
          str = "/tmp"
  file = str+"/test.hdf"
  
- print " -------  We will save to", file, "-----------"
+ print(" -------  We will save to", file, "-----------")
  
 -batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
 +batchmode_geompy.myStudy.SaveAs(file)
  
  #--------------------------------------------------------------------------#
  #---------------------------- Open file -----------------------------------# 
Simple merge
Simple merge
Simple merge
Simple merge
index 05ca6945496d7435a406ecd46024c10d722cad6c,4537accaa115f38ddda619f261096e55256f8025..49f3f67e92dcfb3571136561e7664dcb1a6f3649
@@@ -1620,57 -1673,57 +1620,57 @@@ void Engines_Container_i::copyFile(Engi
  //=============================================================================
  Engines::PyNode_ptr Engines_Container_i::createPyNode(const char* nodeName, const char* code)
  {
 -    Engines::PyNode_var node= Engines::PyNode::_nil();
 +  Engines::PyNode_var node= Engines::PyNode::_nil();
  
 -    PyGILState_STATE gstate = PyGILState_Ensure();
 -    PyObject *res = PyObject_CallMethod(_pyCont,
 -      (char*)"create_pynode",
 -      (char*)"ss",
 -      nodeName,
 -      code);
 -    if(res==NULL)
 -      {
 -        //internal error
 -        PyErr_Print();
 -        PyGILState_Release(gstate);
 -        SALOME::ExceptionStruct es;
 -        es.type = SALOME::INTERNAL_ERROR;
 -        es.text = "can not create a python node";
 -        throw SALOME::SALOME_Exception(es);
 -      }
 -    long ierr=PyLong_AsLong(PyTuple_GetItem(res,0));
 -    PyObject* result=PyTuple_GetItem(res,1);
 -    std::string astr=PyUnicode_AsUTF8(result);
 -    Py_DECREF(res);
 +  PyGILState_STATE gstate = PyGILState_Ensure();
 +  PyObject *res = PyObject_CallMethod(_pyCont,
 +    (char*)"create_pynode",
 +    (char*)"ss",
 +    nodeName,
 +    code);
 +  if(res==NULL)
 +  {
 +    //internal error
 +    PyErr_Print();
      PyGILState_Release(gstate);
 -    if(ierr==0)
 -      {
 -        Utils_Locker lck(&_mutexForDftPy);
 -        CORBA::Object_var obj=_orb->string_to_object(astr.c_str());
 -        node=Engines::PyNode::_narrow(obj);
 -        std::map<std::string,Engines::PyNode_var>::iterator it(_dftPyNode.find(nodeName));
 -        if(it==_dftPyNode.end())
 -          {
 -            _dftPyNode[nodeName]=node;
 -          }
 -        else
 -          {
 -            Engines::PyNode_var oldNode((*it).second);
 -            if(!CORBA::is_nil(oldNode))
 -              oldNode->UnRegister();
 -            (*it).second=node;
 -          }
 -        if(!CORBA::is_nil(node))
 -          node->Register();
 -        return node._retn();
 -      }
 +    SALOME::ExceptionStruct es;
 +    es.type = SALOME::INTERNAL_ERROR;
 +    es.text = "can not create a python node";
 +    throw SALOME::SALOME_Exception(es);
 +  }
-   long ierr=PyInt_AsLong(PyTuple_GetItem(res,0));
++  long ierr=PyLong_AsLong(PyTuple_GetItem(res,0));
 +  PyObject* result=PyTuple_GetItem(res,1);
-   std::string astr=PyString_AsString(result);
++  std::string astr=PyUnicode_AsUTF8(result);
 +  Py_DECREF(res);
 +  PyGILState_Release(gstate);
 +  if(ierr==0)
 +  {
 +    Utils_Locker lck(&_mutexForDftPy);
 +    CORBA::Object_var obj=_orb->string_to_object(astr.c_str());
 +    node=Engines::PyNode::_narrow(obj);
 +    std::map<std::string,Engines::PyNode_var>::iterator it(_dftPyNode.find(nodeName));
 +    if(it==_dftPyNode.end())
 +    {
 +      _dftPyNode[nodeName]=node;
 +    }
      else
 -      {
 -        SALOME::ExceptionStruct es;
 -        es.type = SALOME::INTERNAL_ERROR;
 -        es.text = astr.c_str();
 -        throw SALOME::SALOME_Exception(es);
 -      }
 +    {
 +      Engines::PyNode_var oldNode((*it).second);
 +      if(!CORBA::is_nil(oldNode))
 +        oldNode->UnRegister();
 +      (*it).second=node;
 +    }
 +    if(!CORBA::is_nil(node))
 +      node->Register();
 +    return node._retn();
 +  }
 +  else
 +  {
 +    SALOME::ExceptionStruct es;
 +    es.type = SALOME::INTERNAL_ERROR;
 +    es.text = astr.c_str();
 +    throw SALOME::SALOME_Exception(es);
 +  }
  }
  
  //=============================================================================
@@@ -1703,58 -1756,58 +1703,58 @@@ Engines::PyNode_ptr  Engines_Container_
  //=============================================================================
  Engines::PyScriptNode_ptr Engines_Container_i::createPyScriptNode(const char* nodeName, const char* code)
  {
 -    Engines::PyScriptNode_var node= Engines::PyScriptNode::_nil();
 +  Engines::PyScriptNode_var node= Engines::PyScriptNode::_nil();
  
 -    PyGILState_STATE gstate = PyGILState_Ensure();
 -    PyObject *res = PyObject_CallMethod(_pyCont,
 -      (char*)"create_pyscriptnode",
 -      (char*)"ss",
 -      nodeName,
 -      code);
 -    if(res==NULL)
 -      {
 -        //internal error
 -        PyErr_Print();
 -        PyGILState_Release(gstate);
 -        SALOME::ExceptionStruct es;
 -        es.type = SALOME::INTERNAL_ERROR;
 -        es.text = "can not create a python node";
 -        throw SALOME::SALOME_Exception(es);
 -      }
 -    long ierr=PyLong_AsLong(PyTuple_GetItem(res,0));
 -    PyObject* result=PyTuple_GetItem(res,1);
 -    std::string astr=PyUnicode_AsUTF8(result);
 -    Py_DECREF(res);
 +  PyGILState_STATE gstate = PyGILState_Ensure();
 +  PyObject *res = PyObject_CallMethod(_pyCont,
 +    (char*)"create_pyscriptnode",
 +    (char*)"ss",
 +    nodeName,
 +    code);
 +  if(res==NULL)
 +  {
 +    //internal error
 +    PyErr_Print();
      PyGILState_Release(gstate);
-   long ierr=PyInt_AsLong(PyTuple_GetItem(res,0));
 +    SALOME::ExceptionStruct es;
 +    es.type = SALOME::INTERNAL_ERROR;
 +    es.text = "can not create a python node";
 +    throw SALOME::SALOME_Exception(es);
 +  }
-   std::string astr=PyString_AsString(result);
++  long ierr=PyLong_AsLong(PyTuple_GetItem(res,0));
 +  PyObject* result=PyTuple_GetItem(res,1);
++  std::string astr=PyUnicode_AsUTF8(result);
 +  Py_DECREF(res);
 +  PyGILState_Release(gstate);
  
 -    if(ierr==0)
 -      {
 -        Utils_Locker lck(&_mutexForDftPy);
 -        CORBA::Object_var obj=_orb->string_to_object(astr.c_str());
 -        node=Engines::PyScriptNode::_narrow(obj);
 -        std::map<std::string,Engines::PyScriptNode_var>::iterator it(_dftPyScriptNode.find(nodeName));
 -        if(it==_dftPyScriptNode.end())
 -          {
 -            _dftPyScriptNode[nodeName]=node;
 -          }
 -        else
 -          {
 -            Engines::PyScriptNode_var oldNode((*it).second);
 -            if(!CORBA::is_nil(oldNode))
 -              oldNode->UnRegister();
 -            (*it).second=node;
 -          }
 -        if(!CORBA::is_nil(node))
 -          node->Register();
 -        return node._retn();
 -      }
 +  if(ierr==0)
 +  {
 +    Utils_Locker lck(&_mutexForDftPy);
 +    CORBA::Object_var obj=_orb->string_to_object(astr.c_str());
 +    node=Engines::PyScriptNode::_narrow(obj);
 +    std::map<std::string,Engines::PyScriptNode_var>::iterator it(_dftPyScriptNode.find(nodeName));
 +    if(it==_dftPyScriptNode.end())
 +    {
 +      _dftPyScriptNode[nodeName]=node;
 +    }
      else
 -      {
 -        SALOME::ExceptionStruct es;
 -        es.type = SALOME::INTERNAL_ERROR;
 -        es.text = astr.c_str();
 -        throw SALOME::SALOME_Exception(es);
 -      }
 +    {
 +      Engines::PyScriptNode_var oldNode((*it).second);
 +      if(!CORBA::is_nil(oldNode))
 +        oldNode->UnRegister();
 +      (*it).second=node;
 +    }
 +    if(!CORBA::is_nil(node))
 +      node->Register();
 +    return node._retn();
 +  }
 +  else
 +  {
 +    SALOME::ExceptionStruct es;
 +    es.type = SALOME::INTERNAL_ERROR;
 +    es.text = astr.c_str();
 +    throw SALOME::SALOME_Exception(es);
 +  }
  }
  
  //=============================================================================
Simple merge
Simple merge
index 69316736f912bd52a2b1d5d82c9231ba7e40f24b,a9cce39d04faee5e805c0524fd9c223afd5cb33a..1e24534dc703beba28667be7c7a6fec05a37cfa6
@@@ -199,38 -199,42 +199,38 @@@ class SALOME_ContainerPy_i (Engines__PO
      
      #-------------------------------------------------------------------------
  
 -    def create_component_instance_env(self, componentName, studyId, env):
 -      return self.create_component_instance(componentName, studyId), ""
 +    def create_component_instance_env(self, componentName, env):
 +      return self.create_component_instance(componentName), ""
  
 -    def create_component_instance(self, componentName, studyId):
 -        MESSAGE( "SALOME_ContainerPy_i::create_component_instance ==> " + str(componentName) + ' ' + str(studyId) )
 -        if studyId < 0:
 -            MESSAGE( "Study ID is lower than 0!" )
 -            return None
 -        else:
 -            self._numInstance = self._numInstance +1
 -            instanceName = componentName + "_inst_" + repr(self._numInstance)
 -            comp_iors=""
 -            try:
 -                component=__import__(componentName)
 -                factory=getattr(component,componentName)
 -                comp_i=factory(self._orb,
 -                               self._poa,
 -                               self._this(),
 -                               self._containerName,
 -                               instanceName,
 -                               componentName)
 -                
 -                MESSAGE( "SALOME_Container_i::create_component_instance : OK")
 -                comp_o = comp_i._this()
 -                self._listInstances_map[instanceName] = comp_i
 -            except:
 -                import traceback
 -                traceback.print_exc()
 -                MESSAGE( "SALOME_Container_i::create_component_instance : NOT OK")
 -            return comp_o
 +    def create_component_instance(self, componentName):
 +        MESSAGE( "SALOME_ContainerPy_i::create_component_instance ==> " + str(componentName) )
 +        self._numInstance = self._numInstance +1
-         instanceName = componentName + "_inst_" + `self._numInstance`
++        instanceName = componentName + "_inst_" + repr(self._numInstance)
 +        comp_iors=""
 +        try:
 +            component=__import__(componentName)
 +            factory=getattr(component,componentName)
 +            comp_i=factory(self._orb,
 +                           self._poa,
 +                           self._this(),
 +                           self._containerName,
 +                           instanceName,
 +                           componentName)
 +            
 +            MESSAGE( "SALOME_Container_i::create_component_instance : OK")
 +            comp_o = comp_i._this()
 +            self._listInstances_map[instanceName] = comp_i
 +        except:
 +            import traceback
 +            traceback.print_exc()
 +            MESSAGE( "SALOME_Container_i::create_component_instance : NOT OK")
 +        return comp_o
  
      #-------------------------------------------------------------------------
  
 -    def find_component_instance(self, registeredName, studyId):
 +    def find_component_instance(self, registeredName):
          anEngine = None
-         keysList = self._listInstances_map.keys()
+         keysList = list(self._listInstances_map.keys())
          i = 0
          while i < len(keysList):
              instance = keysList[i]
index 4fd4a5e56a0cf224ff1cb668f682e6688ba5172d,9100c5694470ee49514e4c794b4a8e60d2b0f6bb..fc03d773f629f0a3ae6bd254421c49c3d901d69b
@@@ -75,10 -77,10 +75,10 @@@ variables
                             methods : defined in SALOMEDS.idl
                                                           
  methods:
 -  salome.DumpStudy(study) : Dump a study, given the ior
 +  salome.DumpStudy() : Dump a study, given the ior
  ---
  '''
-         print doc_salome
+         print(doc_salome)
          
      def geompy(self):
          doc_geompy = '''
index c14efb15247b9e381c8486990aba34ba45153d5d,79cec890e1de3a81d4b841c83304e891ce7b9877..e33625b6a73c0a365927ca724a8bc65880d91ffa
@@@ -60,8 -59,8 +60,8 @@@ def DumpComponent(SO, offset)
              while ofs <= offset:
                  a = a + "  "
                  ofs = ofs +1
-             print a + ">" + RefSO.GetID()
+             print(a + ">" + RefSO.GetID())
 -        DumpComponent(Study, CSO, offset+2)
 +        DumpComponent(CSO, offset+2)
  
      #--------------------------------------------------------------------------
  
@@@ -72,8 -70,8 +72,8 @@@ def DumpStudy()
          SC = itcomp.Value()
          itcomp.Next()
          name = SC.ComponentDataType()
-         print "-> ComponentDataType is " + name
+         print("-> ComponentDataType is " + name)
 -        DumpComponent(Study, SC, 1)
 +        DumpComponent(SC, 1)
          
  
      #--------------------------------------------------------------------------
@@@ -90,10 -88,16 +90,10 @@@ sg = SALOMEGUI_Swig(
  #create an naming service instance
  naming_service = SALOME_NamingServicePy_i(orb)
  
 -# get active study name and id
 -myStudyName = sg.getActiveStudyName()
 +# get active study name
 +myStudyName = sg.getStudyName()
- print myStudyName
+ print(myStudyName)
  
 -myStudyId = sg.getActiveStudyId()
 -print(myStudyId)
 -
 -# get Study Manager reference
 -obj = naming_service.Resolve('myStudyManager')
 -myStudyManager = obj._narrow(SALOMEDS.StudyManager)
 -
 -# get active study
 -myStudy = myStudyManager.GetStudyByName(myStudyName)
 +# get Study reference
 +obj = naming_service.Resolve('/Study')
 +myStudy = obj._narrow(SALOMEDS.Study)
index 514f741c1f895349ee71d9ad27db49507245f9db,16104045ad9abe095f5f63164ae67dcfb5078697..79fb951dfecb3cd231d158f091ddf7c0bbf2734a
@@@ -187,10 -221,10 +187,10 @@@ def salome_init(embedded=0)
              salome_initial=0
              sg = salome_iapp_init(embedded)
              orb, lcc, naming_service, cm = salome_kernel_init()
 -            myStudyManager, myStudyId, myStudy, myStudyName = salome_study_init(theStudyId)
 +            myStudy, myStudyName = salome_study_init()
              pass
          pass
-     except RuntimeError, inst:
+     except RuntimeError as inst:
          # wait a little to avoid trace mix
          import time
          time.sleep(0.2)
index 4e52b1fe4d35accb1c5f33fb08c1048e5a1bd026,6cf554390338e88983aaca90531acd97a831880b..59a0bfc8543bb563bc310df5117ae8891112693c
@@@ -178,28 -178,28 +178,30 @@@ def CheckCopyPaste(theSO, theInfo ,theC
      while aRoot.GetID() != "0:":
          aRoot = aRoot.GetFather()
      aTree = GetTree(aRoot)
 -    if not myStudyManager.CanCopy(theSO):
 +    aStudyPersist = PersistentPresentation(aRoot, 1)
 +
+     aStudyPersist = PersistentPresentation(myStudy, aRoot, 1)
-         raise RuntimeError, "<CanCopy> for "+theInfo+" returns false"
 +    if not myStudy.CanCopy(theSO):
+         raise RuntimeError("<CanCopy> for "+theInfo+" returns false")
      
 -    if not myStudyManager.Copy(theSO):
 +    if not myStudy.Copy(theSO):
-         raise RuntimeError, "<Copy> for "+theInfo+" returns false"
+         raise RuntimeError("<Copy> for "+theInfo+" returns false")
  
      
 -    if not myStudyManager.CanPaste(theSO):
 +    if not myStudy.CanPaste(theSO):
-         raise RuntimeError, "<CanPaste> for "+theInfo+" returns false"
+         raise RuntimeError("<CanPaste> for "+theInfo+" returns false")
  
      # check: before paste study is not changed check
 -    if aStudyPersist != PersistentPresentation(myStudy, aRoot, 1):
 +    if aStudyPersist != PersistentPresentation(aRoot, 1):
-         raise RuntimeError, "Study is changed before Paste calling for "+theInfo
+         raise RuntimeError("Study is changed before Paste calling for "+theInfo)
      
      aSObj = theSO
      if theComponentPaste:
          aSObj = theSO.GetFatherComponent()
          theInfo = theInfo + "(paste for component)"
 -    if myStudyManager.Paste(aSObj) == None:
 +    if myStudy.Paste(aSObj) == None:
-         raise RuntimeError, "<Paste> for "+theInfo+" returns None object"
+         raise RuntimeError("<Paste> for "+theInfo+" returns None object")
      aNewTree = GetTree(aRoot)
      aLen = len(aTree)
      for a in range(0,aLen):
@@@ -283,10 -283,23 +285,11 @@@ while 1
      time.sleep(sleeping_time)
      sleeping_time = max(sleeping_time_max, 2*sleeping_time)
      pass
--     
 -myStudyManager = obj._narrow(SALOMEDS.StudyManager)
 -
 -if myStudyManager is None:
 -    print("Warning: SALOMEDS.StudyManager has not been created !!!")
 -
 -# create new study
 -aListOfOpenStudies = myStudyManager.GetOpenStudies();
 -myStudy = None;
 -if len(aListOfOpenStudies) == 0 :
 -    myStudy = myStudyManager.NewStudy("Study1")
 -else:
 -    myStudyName = aListOfOpenStudies[0]
 -    myStudy = myStudyManager.GetStudyByName(myStudyName)
+     
 -myStudyName = myStudy._get_Name()
 +myStudy = obj._narrow(SALOMEDS.Study)
  
 -myStudyId = myStudy._get_StudyId()
 -# print(myStudyId)
 +if myStudy is None:
-     print "Warning: SALOMEDS.Study has not been created !!!"
++    print("Warning: SALOMEDS.Study has not been created !!!")
 +    
 +myStudyName = myStudy._get_Name()
index c8ab30236bf2b85727194c0a1a198965afa38e48,5e6c8db0fbc273d15301f30f6f8db71b0d8bbc73..e14023b7e84afbae17d12aebe9fde18408c7ce7b
@@@ -120,18 -120,24 +120,18 @@@ 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()
  
 -## Get a study manager to create and manage %SALOME studies
 -#  \ingroup service
 -def getStudyManager():
 -    """Get a study manager to create and manage SALOME studies"""
 -    return salome.myStudyManager
 -
  import SALOMEDS
 -## Get a study manager to create and manage SALOME studies
 -#  \warning you should use instead the variable salome.myStudyManager
 +## Get a study to create SALOME study
 +#  \warning you should use instead the variable salome.myStudy. 
  #  This function is given for illustration of usage of the naming service
  #  \ingroup service
 -def __getStudyManager_demo():
 +def __getStudy_demo():
      """
 -    Get a study manager to create and manage SALOME studies. WARN: you
 -    should use instead the variable salome.myStudyManager. This
 +    Get a study to create SALOME study. WARN: you
 +    should use instead the variable salome.myStudy. This
      function is given for illustration of usage of the naming service
      """
      naming_service = SALOME_NamingServicePy_i( orb )
index 98aad628287c203f0d0cff3b1b22bfd0c9d582bb,ccc2e06800dc1ef5f859bc00c8d70fcfe639cb86..c047b046f610cbff380d9c9ef0f581d96755853e
@@@ -31,27 -31,61 +31,27 @@@ This module provides a new class :class
  
  import re
  
- import salome
- from salome.kernel.logger import Logger
  from salome.kernel import termcolor
- logger = Logger("salome.kernel.studyedit", color = termcolor.PURPLE)
+ from salome.kernel.logger import Logger
+ import salome
+ logger = Logger("salome.kernel.studyedit", color=termcolor.PURPLE)
  
 -_editors = {}
 +_editor = None
  _DEFAULT_CONTAINER = "FactoryServer"
  
- # The codec to use for strings that are displayed in Salome study tree is Latin-1
- ENCODING_FOR_SALOME_STUDY = "iso-8859-1"
 -## Return the ID of the active study. In GUI mode, this function is equivalent
 -#  to salome.sg.getActiveStudyId(). Outside GUI, it returns <b> salome.myStudyId </b>
 -#  variable.
 -#  \ingroup studyedit
 -def getActiveStudyId():
 -    """
 -    Return the ID of the active study. In GUI mode, this function is equivalent
 -    to ``salome.sg.getActiveStudyId()``. Outside GUI, it returns
 -    ``salome.myStudyId`` variable.
 -    """
 -    salome.salome_init()
 -    # Warning: we don't use salome.getActiveStudy() here because it doesn't
 -    # work properly when called from Salome modules (multi-study interpreter
 -    # issue)
 -    if salome.hasDesktop():
 -        return salome.sg.getActiveStudyId()
 -    else:
 -        return salome.myStudyId
 -
 -def getActiveStudy():
 -    return getStudyFromStudyId(getActiveStudyId())
 -
 -def getStudyFromStudyId(studyId):
 -    salome.salome_init()
 -    study = salome.myStudyManager.GetStudyByID(studyId)
 -    return study
  
 -def getStudyIdFromStudy(study):
 -    studyId = study._get_StudyId()
 -    return studyId
 -
 -## Return a \b StudyEditor instance to edit the study with ID studyId. 
 -#  If \b studyId is \b None, return an editor for the current study.
 +## Return a \b StudyEditor instance to edit the study. 
  #  \ingroup studyedit
 -def getStudyEditor(studyId = None):
 +def getStudyEditor():
      """
 -    Return a :class:`StudyEditor` instance to edit the study with ID
 -    `studyId`. If `studyId` is :const:`None`, return an editor for the current
 -    study.
 +    Return a :class:`StudyEditor` instance to edit the study.
      """
 -    if studyId is None:
 -        studyId = getActiveStudyId()
 -    if studyId not in _editors:
 -        _editors[studyId] = StudyEditor(studyId)
 -    return _editors[studyId]
 +    global _editor
 +    if _editor is None:
 +        _editor = StudyEditor()
 +    return _editor
  
  ## This class provides utility methods to complement \b Study and
  #  \b StudyBuilder classes. Those methods may be moved in those classes
Simple merge
index cdd942bd1bd35a37b89d18621598f847a3054bf8,b7aa1557d240cacb290d435577274b168e2b1e97..c3aa0cbf8c80bde41ce29f8b38d80148dd90f11b
@@@ -77,14 -77,19 +77,14 @@@ class SalomeOutsideGUI(object)
          """Indicate if GUI is running"""
          return False
      
 -    def updateObjBrowser(self, bid):
 +    def updateObjBrowser(self):
          """update the GUI object browser"""
-         print "SalomeOutsideGUI: no objectBrowser update outside GUI"
+         print("SalomeOutsideGUI: no objectBrowser update outside GUI")
          pass
      
 -    def getActiveStudyId(self):
 -        """Get the active study id"""
 -        print("SalomeOutsideGUI.getActiveStudyId: avoid use outside GUI")
 -        return myStudyId
 -    
 -    def getActiveStudyName(self):
 -        """Get the active study name"""
 -        print("SalomeOutsideGUI.getActiveStudyName: avoid use outside GUI")
 +    def getStudyName(self):
 +        """Get the study name"""
-         print "SalomeOutsideGUI.getStudyName: avoid use outside GUI"
++        print("SalomeOutsideGUI.getStudyName: avoid use outside GUI")
          return myStudyName
      
      def SelectedCount(self):
Simple merge
index efd41940bc04059b3973c8dec3d13aafb9e685cc,b31fad8998b1972b0bdf0e909da8e5e9645bf674..be6d72f2932813be3890a65822f28c816087d088
@@@ -51,8 -52,8 +51,8 @@@ def DumpComponent(SO, Builder,offset)
      find,RefSO = CSO.ReferencedObject()
      if find:
        a=a+":"+RefSO.GetID()
-     print a
+     print(a)
 -    DumpComponent(Study, CSO, Builder,offset+2)
 +    DumpComponent(CSO, Builder,offset+2)
      it.Next()
  
  #--------------------------------------------------------------------------
@@@ -67,10 -67,21 +67,10 @@@ def DumpStudy()
      while itcomp.More():
        SC = itcomp.Value()
        name = SC.ComponentDataType()
-       print "-> ComponentDataType is " + name
+       print("-> ComponentDataType is " + name)
 -      DumpComponent(Study, SC,Builder, 1)
 +      DumpComponent(SC,Builder, 1)
        itcomp.Next()
  
 -def DumpStudies():
 -  """
 -    Dump all studies in a StudyManager
 -  """
 -  global myStudyManager
 -  for name in myStudyManager.GetOpenStudies():
 -    s = myStudyManager.GetStudyByName(name)
 -    print("study:",name, s._get_StudyId())
 -    DumpStudy(s)
 -
 -
  #--------------------------------------------------------------------------
  
  def IDToObject(id):
@@@ -194,28 -203,28 +194,28 @@@ def CheckCopyPaste(theSO, theInfo ,theC
      while aRoot.GetID() != "0:":
          aRoot = aRoot.GetFather()
      aTree = GetTree(aRoot)
 -    aStudyPersist = PersistentPresentation(myStudy, aRoot, 1)
 +    aStudyPersist = PersistentPresentation(aRoot, 1)
  
 -    if not myStudyManager.CanCopy(theSO):
 +    if not myStudy.CanCopy(theSO):
-         raise RuntimeError, "<CanCopy> for "+theInfo+" returns false"
+         raise RuntimeError("<CanCopy> for "+theInfo+" returns false")
      
 -    if not myStudyManager.Copy(theSO):
 +    if not myStudy.Copy(theSO):
-         raise RuntimeError, "<Copy> for "+theInfo+" returns false"
+         raise RuntimeError("<Copy> for "+theInfo+" returns false")
  
      
 -    if not myStudyManager.CanPaste(theSO):
 +    if not myStudy.CanPaste(theSO):
-         raise RuntimeError, "<CanPaste> for "+theInfo+" returns false"
+         raise RuntimeError("<CanPaste> for "+theInfo+" returns false")
  
      # check: before paste study is not changed check
 -    if aStudyPersist != PersistentPresentation(myStudy, aRoot, 1):
 +    if aStudyPersist != PersistentPresentation(aRoot, 1):
-         raise RuntimeError, "Study is changed before Paste calling for "+theInfo
+         raise RuntimeError("Study is changed before Paste calling for "+theInfo)
      
      aSObj = theSO
      if theComponentPaste:
          aSObj = theSO.GetFatherComponent()
          theInfo = theInfo + "(paste for component)"
 -    if myStudyManager.Paste(aSObj) == None:
 +    if myStudy.Paste(aSObj) == None:
-         raise RuntimeError, "<Paste> for "+theInfo+" returns None object"
+         raise RuntimeError("<Paste> for "+theInfo+" returns None object")
      aNewTree = GetTree(aRoot)
      aLen = len(aTree)
      for a in range(0,aLen):
@@@ -270,12 -279,97 +270,12 @@@ def FindFileInDataDir(filename)
  
      #--------------------------------------------------------------------------
  
 -salome_study_ID = -1
 -
 -# *args are used here to support backward compatibility
 -# previously it was possible to pass theStudyId parameter to this function
 -# which is no more supported.
 -def getActiveStudy(*args):
 -    global myStudyManager
 -    global salome_study_ID
 -
 -    if not myStudyManager:
 -        print("No active study")
 -        return None
 -        pass
 -
 -    if verbose(): print("getActiveStudy")
 -    if salome_study_ID == -1:
 -        listOpenStudies = myStudyManager.GetOpenStudies()
 -        if len(listOpenStudies) == 0:
 -            return None
 -        else:
 -            s = myStudyManager.GetStudyByName(listOpenStudies[0])
 -            salome_study_ID = s._get_StudyId()
 -    if verbose(): print("--- Study Id ", salome_study_ID)
 -    return salome_study_ID
 -
 -    #--------------------------------------------------------------------------
 -
 -def setCurrentStudy(theStudy):
 -    """
 -    Change current study : an existing one given by a study object.
 -
 -    :param theStudy: the study CORBA object to set as current study
 -
 -    Obsolete: only one study can be opened at the moment.
 -    This function works properly if specified theStudy parameter
 -    corresponds to the currently opened study.
 -    Kept for backward compatibility only.
 -    """
 -    global myStudyId, myStudy, myStudyName
 -    global salome_study_ID
 -    myStudy = theStudy
 -    myStudyId = theStudy._get_StudyId()
 -    myStudyName = theStudy._get_Name()
 -    return myStudyId, myStudy, myStudyName
 -
 -    #--------------------------------------------------------------------------
 -
 -# *args are used here to support backward compatibility
 -# previously it was possible to pass theStudyId parameter to this function
 -# which is no more supported.
 -def setCurrentStudyId(*args):
 -    """
 -    Change current study : an existing or new one.
 -
 -    This function connects to the single opened study if there is any; otherwise
 -    new empty study is created.
 -
 -    Obsolete: only one study can be opened at the moment.
 -    Kept for backward compatibility only.
 -    """
 -    global myStudyManager, myStudyId, myStudy, myStudyName
 -    global salome_study_ID
 -    salome_study_ID = -1
 -    myStudyId = getActiveStudy()
 -    if not myStudyId:
 -      myStudyId = createNewStudy()
 -    if verbose(): print("myStudyId",myStudyId)
 -    myStudy = myStudyManager.GetStudyByID(myStudyId)
 -    myStudyName = myStudy._get_Name()
 -    return myStudyId, myStudy, myStudyName
 -
 -    #--------------------------------------------------------------------------
 -
 -def createNewStudy():
 -    global myStudyManager
 -    print("createNewStudy")
 -    aStudyName = "extStudy"
 -    theStudy = myStudyManager.NewStudy(aStudyName)
 -    theStudyId = theStudy._get_StudyId()
 -    print(aStudyName, theStudyId)
 -    return theStudyId
 -
 -    #--------------------------------------------------------------------------
 -
  def openStudy(theStudyPath):
-     print "openStudy"
 -    global myStudyManager
+     print("openStudy")
 -    theStudy = myStudyManager.Open(theStudyPath)
 -    theStudyId = theStudy._get_StudyId()
 -    print(theStudyPath, theStudyId)
 -    return theStudyId
 +    global myStudy, myStudyName
 +    myStudy.Open(theStudyPath)
 +    myStudyName = myStudy._get_Name()
-     print theStudyPath, myStudy._get_Name()
++    print(theStudyPath, myStudy._get_Name())
  
      #--------------------------------------------------------------------------
  
@@@ -287,24 -381,40 +287,24 @@@ def salome_study_init(theStudyPath=None
                        create new empty study if there is active study
          <URL> (str) : open study with the given file name
      """
 -    global myStudyManager, myStudyId, myStudy, myStudyName
 +    global myStudy, myStudyName
      global orb, lcc, naming_service, cm
  
-     if verbose(): print "theStudyPath:", theStudyPath
+     if verbose(): print("theStudyPath:", theStudyPath)
 -    if not myStudyManager:
 +    if not myStudy:
          orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init()
  
 -        # get Study Manager reference
 -        if verbose(): print("looking for studyManager ...")
 -        obj = naming_service.Resolve('myStudyManager')
 -        myStudyManager = obj._narrow(SALOMEDS.StudyManager)
 -        if verbose(): print("studyManager found")
 +        # get Study reference
-         if verbose(): print "looking for study..."
++        if verbose(): print("looking for study...")
 +        obj = naming_service.Resolve('/Study')
 +        myStudy = obj._narrow(SALOMEDS.Study)
-         if verbose(): print "Study found"
++        if verbose(): print("Study found")
          pass
  
 -    # get active study Id, ref and name
 -    myStudy = None
 -    myStudyId = getActiveStudy()
 -    if myStudyId == None :
 -        import types
 -        if theStudyPath and (type(theStudyPath) == bytes or type(theStudyPath) == str):
 -            myStudyId = openStudy(theStudyPath)
 -        else:
 -            myStudyId = createNewStudy()
 -    if verbose(): print("myStudyId", myStudyId)
 -
 -    if myStudy == None:
 -        myStudy = myStudyManager.GetStudyByID(myStudyId)
 -    myStudyName = myStudy._get_Name()
 +    import types
 +    if theStudyPath and type(theStudyPath) == types.StringType:
 +        openStudy(theStudyPath)
  
 -    return myStudyManager, myStudyId, myStudy, myStudyName
 +    myStudyName = myStudy._get_Name()
  
 -def salome_study_close():
 -    global salome_study_ID
 -    global myStudyId, myStudy, myStudyName
 -    salome_study_ID = -1
 -    myStudyId, myStudy, myStudyName = None, None, None
 -    pass
 +    return myStudy, myStudyName
index 4713d36260dbd95fcb9c333aaabcfa75f99c9843,08070cb210dcb0fa9b8b37948d8989a141dfb34b..60efd54fcb21cf52766786ded5cd9a8bfbd839e6
@@@ -54,65 -54,65 +54,65 @@@ print("================================
  obj = salome.naming_service.Resolve('Kernel/ModulCatalog')
  catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
  if not catalog:
-     raise RuntimeError, "Can't accesss module catalog"
- print "OK"
+     raise RuntimeError("Can't accesss module catalog")
+ print("OK")
  
- print
+ print()
  
- print "======================================================================"
- print "           %d. Check modules availability in the module catalog " % step; step+=1
- print "======================================================================"
+ print("======================================================================")
+ print("           %d. Check modules availability in the module catalog " % step); step+=1
+ print("======================================================================")
  
  for module in [ "GEOM", "SMESH", "MEDFactory", "PVSERVER"]:
-     print
-     print "--- Check %s ..." % module
+     print()
+     print("--- Check %s ..." % module)
      comp = catalog.GetComponent(module)
      if not comp:
-         raise RuntimeError, "Component %s is not found in Module Catalog." % module
-     print "OK"
+         raise RuntimeError("Component %s is not found in Module Catalog." % module)
+     print("OK")
      pass
  
- print
+ print()
  
- print "======================================================================"
- print "           %d. Test Data Server " % step; step+=1
- print "======================================================================"
+ print("======================================================================")
+ print("           %d. Test Data Server " % step); step+=1
+ print("======================================================================")
  
- print
- print "--- Create new component ..."
+ print()
+ print("--- Create new component ...")
  comp = builder.NewComponent("TEST")
  if not comp:
-     raise RuntimeError, "Can't create new component"
- print "OK"
+     raise RuntimeError("Can't create new component")
+ print("OK")
  
- print
- print "--- Create AttributeName ..."
+ print()
+ print("--- Create AttributeName ...")
  A = builder.FindOrCreateAttribute(comp, "AttributeName")
  if not A:
-     raise RuntimeError, "Can't create AttributeName attribute"
+     raise RuntimeError("Can't create AttributeName attribute")
  A.SetValue("TEST")
  if A.Value() != "TEST":
-     raise RuntimeError, "Error : wrong value of  AttributeName"
- print "OK"
+     raise RuntimeError("Error : wrong value of  AttributeName")
+ print("OK")
  
- print
- print "--- Create AttributeReal ..."
+ print()
+ print("--- Create AttributeReal ...")
  A = builder.FindOrCreateAttribute(comp, "AttributeReal")
  if not A:
-     raise RuntimeError, "Can't create AttributeReal attribute"
+     raise RuntimeError("Can't create AttributeReal attribute")
  A.SetValue(0.0001)
  if A.Value() != 0.0001:
-     raise RuntimeError, "Error : wrong value of  AttributeReal"
- print "OK"
+     raise RuntimeError("Error : wrong value of  AttributeReal")
+ print("OK")
  
- print
+ print()
  
- print "======================================================================"
- print "           %d. Test Geometry " % step; step+=1
- print "======================================================================"
+ print("======================================================================")
+ print("           %d. Test Geometry " % step); step+=1
+ print("======================================================================")
  
  from salome.geom import geomBuilder
 -geompy = geomBuilder.New(salome.myStudy)
 +geompy = geomBuilder.New()
  
  ShapeTypeCompSolid = 1
  ShapeTypeSolid = 2
@@@ -163,13 -163,13 +163,13 @@@ print("OK"
  
  # ---- update object browser
  if salome.hasDesktop():
 -    salome.sg.updateObjBrowser(True);
 +    salome.sg.updateObjBrowser();
  
- print
+ print()
  
- print "======================================================================"
- print "           %d. Test Mesh " % step; step+=1
- print "======================================================================"
+ print("======================================================================")
+ print("           %d. Test Mesh " % step); step+=1
+ print("======================================================================")
  
  from salome.StdMeshers import StdMeshersBuilder
  import SMESH
@@@ -300,13 -300,13 +300,13 @@@ print("OK"
  
  # ---- update object browser
  if salome.hasDesktop():
 -    salome.sg.updateObjBrowser(True);
 +    salome.sg.updateObjBrowser();
  
- print
+ print()
  
- print "======================================================================"
- print "           %d. Test Med " % step; step+=1
- print "======================================================================"
+ print("======================================================================")
+ print("           %d. Test Med " % step); step+=1
+ print("======================================================================")
  
  import medcalc
  #from medcalc import properties
index c9f02549fc84f42428c113a4437ee27ba85d6b6e,2b9ee1583e92ab6e0414e84d5b6e74ddabc7750e..920c9034b53e0b86c0ef4384992bd66b437a102f
@@@ -103,11 -91,11 +103,11 @@@ f.close(
      job_params.out_files = ["result.txt", "subdir"]
      job_params.resource_required = salome.ResourceParameters()
      job_params.resource_required.nb_proc = 1
 -    
 +
      launcher = salome.naming_service.Resolve('/SalomeLauncher')
 -    
 +
      for resource in self.ressources:
-       print "Testing python_salome job on ", resource
+       print("Testing python_salome job on ", resource)
        job_params.result_directory = local_result_dir + resource
        job_params.job_name = "PyJob" + resource
        job_params.resource_required.name = resource
@@@ -312,9 -301,9 +312,9 @@@ f.close(
  
      launcher = salome.naming_service.Resolve('/SalomeLauncher')
      resManager= salome.lcc.getResourcesManager()
 -    
 +
      for resource in self.ressources:
-       print "Testing yacs job on ", resource
+       print("Testing yacs job on ", resource)
        job_params.result_directory = local_result_dir + resource
        job_params.job_name = "YacsJob_" + resource
        job_params.resource_required.name = resource
@@@ -426,9 -416,9 +426,9 @@@ f.close(
  
      launcher = salome.naming_service.Resolve('/SalomeLauncher')
      resManager= salome.lcc.getResourcesManager()
 -    
 +
      for resource in self.ressources:
-       print "Testing yacs job with options on ", resource
+       print("Testing yacs job with options on ", resource)
        job_params.result_directory = local_result_dir + resource
        job_params.job_name = "YacsJobOpt_" + resource
        job_params.resource_required.name = resource
Simple merge
index 0d6d9a060efe8a3f2a639aafad46825a7b0768de,bc10283c5c9b2cf78b54847d32b4d6658b75b4b3..b2107353af7824a8ea1681aeb556c4571b2f64ad
@@@ -831,9 -831,10 +829,9 @@@ def run(tree, args)
      common_data["COMP_NAME"]  = getParamValue("name",       "",                args)
      common_data["COMP_UNAME"] = getParamValue("username",   "",                args)
      common_data["COMP_TYPE"]  = getParamValue("type",       "OTHER",           args)
 -    common_data["COMP_MULT"]  = getParamValue("multistudy", "1",               args)
      common_data["COMP_IMPL"]  = getParamValue("impltype",   "1",               args)
  
-     print common_data
+     print(common_data)
  
      remove_comp = getParamValue("remove", "", args)
  
  
  
  if __name__ == "__main__":
-     print
-     print "Usage : omniidl -bIDLparser [-I<catalog files directory>]* -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,username=<component_username>][,impltype=<implementation type : 0 (python), 1 (C++)>] <file.idl>"
-     print
+     print()
 -    print("Usage : omniidl -bIDLparser [-I<catalog files directory>]* -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,username=<component_username>][,multistudy=<component_multistudy>][,impltype=<implementation type : 0 (python), 1 (C++)>] <file.idl>")
++    print("Usage : omniidl -bIDLparser [-I<catalog files directory>]* -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,username=<component_username>][,impltype=<implementation type : 0 (python), 1 (C++)>] <file.idl>")
+     print()
index 25b63dc5a60094ce477f544cdcf6422f28dcd740,c04961aa27d5ec3f42dea3c27f40e826d6221ace..c76daf90883852431f1c47723b37a2dab274b1a9
@@@ -2097,14 -1290,18 +2097,14 @@@ bool SALOMEDSImpl_Study::DumpStudy(cons
    sfp << "import sys" << std::endl;
    sfp << "import " << aBatchModeScript << std::endl << std::endl;
  
 -  std::string aStudyVar = "salome.myStudy";
    // initialization function
    sfp << aBatchModeScript << ".salome_init()" << std::endl;
 -  if ( !isMultiFile ) {
 -    sfp << "theStudy = " << aStudyVar << std::endl << std::endl;
 -    aStudyVar = "theStudy";
 -  }
 +
    // notebook initialization
 -  sfp << _GetNoteBookAccess(aStudyVar) << std::endl;
 +  sfp << _GetNoteBookAccess() << std::endl;
  
    // extend sys.path with the directory where the script is being dumped to
-   sfp << "sys.path.insert( 0, r\'" << thePath << "\')" << std::endl << std::endl;
+   sfp << "sys.path.insert(0, r\'" << thePath << "\')" << std::endl << std::endl;
  
    // dump NoteBook variables
    sfp << _GetStudyVariablesScript();