1 #! /usr/bin/env python3
3 # Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 # Identify application path then locate configuration files
27 currentPath = os.path.realpath(os.path.dirname(os.path.abspath(__file__)))
28 launcherFile = os.path.basename(__file__)
29 from salome_starter import initialize
30 initialize(currentPath, launcherFile)
32 if len(args) == 1 and args[0] in ['--help', 'help', '-h', '--h']:
33 from salomeContext import usage
37 from salomeContextUtils import getConfigFileNames
38 configFileNames, args, unexisting = getConfigFileNames(args, checkExistence=True)
40 if len(unexisting) > 0:
41 print("ERROR: unexisting configuration/environment file(s): " + ', '.join(unexisting))
44 # Create a SalomeContext which parses configFileNames to initialize environment
45 from salomeContextUtils import SalomeContextException
47 from salomeContext import SalomeContext
48 context = SalomeContext(configFileNames)
50 # Here set specific variables, if needed
51 # context.addToPath('mypath')
52 # context.addToLdLibraryPath('myldlibrarypath')
53 # context.addToPythonPath('mypythonpath')
54 # context.setVariable('myvarname', 'value')
56 # Start SALOME, parsing command line arguments
57 out, err, returncode = context.runSalome(args)
62 #print('Thank you for using SALOME!')
64 except SalomeContextException as e:
66 logging.getLogger("salome").error(e)
70 if __name__ == "__main__":