Hello,
how to run salome scripts directly from python? I would like to run python scripts generated by salome without using GUI.
Thanks,
zmladen
Hello,
how to run salome scripts directly from python? I would like to run python scripts generated by salome without using GUI.
Thanks,
zmladen
Without the gui ,you can use in the terminal
salome -t yourScript.py
Nevertheless is quiet complex to run directly from python (something like python yourScript.py) have a look on the forum it has already been asked and answered.
Best regards
You can call salome to run a file within a python script, but it will open its own terminal/python instance to run Salome through.
import subprocess
salomePath = "C://SALOME-9.9.0/run_salome.bat"
dumpFile = "exampleDumpFile.py"
subprocess.call([salomePath, "-t", "python", dumpFile])
The “-t” in the subprocess call will run salome terminal mode. If you wish to open the GUI, exclude the “-t”. See documentation here.
Hi,
it is much easier since SALOME 9.9.0. You just have to add the SALOME environment with:
source env_launch.sh
or:
./salome context
then:
python yourscript.py
should work.
Christophe
Thank you all for fast responces. The solution from LGutknecht works well.
Thanks,
zmladen