Salome HOME
SWP12966 - MutiFile is not saved correctly
[modules/kernel.git] / src / KERNEL_PY / salome.py
index 58299dbc53bfe946c40f359016e35662560b8800..956a767bd71cb85c1f4176cca3d8a4dd4d5c8f80 100755 (executable)
@@ -15,7 +15,7 @@
 #  License along with this library; if not, write to the Free Software 
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 # 
-#  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 #
 #
 #  Module : SALOME
 #  $Header$
 
-import sys
-# On Win32, don't use omnipatch with omniOrb 4.0.7 so far
-if not sys.platform == "win32":
-    import omnipatch 
-
 from salome_kernel import *
 from salome_study import *
 from salome_iapp import *
 
 salome_initial=1
-def salome_init(theStudyId=0):
+def salome_init(theStudyId=0,embedded=0):
     """
     Performs only once SALOME general purpose intialisation for scripts.
     optional argument : theStudyId
@@ -59,10 +54,26 @@ def salome_init(theStudyId=0):
     global orb, lcc, naming_service, cm
     global sg
     global myStudyManager, myStudyId, myStudy, myStudyName
-    
-    if salome_initial:
-        salome_initial=0
-        sg = salome_iapp_init()
-        orb, lcc, naming_service, cm = salome_kernel_init()
-        myStudyManager, myStudyId, myStudy, myStudyName =salome_study_init(theStudyId)
 
+    try:
+        if salome_initial:
+            salome_initial=0
+            sg = salome_iapp_init(embedded)
+            orb, lcc, naming_service, cm = salome_kernel_init()
+            myStudyManager, myStudyId, myStudy, myStudyName =salome_study_init(theStudyId)
+            pass
+        pass
+    except RuntimeError, inst:
+        # wait a little to avoid trace mix
+        import time
+        time.sleep(0.2)
+        x = inst
+        print "salome.salome_init():", x
+        print """
+        ============================================
+        May be there is no running SALOME session
+        salome.salome_init() is intented to be used
+        within an already running session
+        ============================================
+        """
+        raise