Skip to content

Commit de70a5c

Browse files
running scripts
1 parent fa5c846 commit de70a5c

5 files changed

Lines changed: 20 additions & 17 deletions

File tree

kratos.gid/exec/compiled.unix.bat

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ fi
2828

2929
# Prevents the PYTHONHOME error from happening and isolate possible python repacks present
3030
# in the system and interfeering with runkratos
31-
export PYTHONHOME=""
3231
export PYTHONPATH=$kratos_bin_path:$PYTHONPATH
3332

33+
34+
export PATH=$kratos_bin_path\libs;$PATH
35+
export PYTHONHOME=$python_home
36+
3437
KERNEL_NAME="linux"
3538

3639

kratos.gid/exec/compiled.win.bat

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,9 @@ DEL "%2\vtk_output"
2020

2121
@REM echo "Launching on Compiled for windows -> %kratos_bin_path%" > .run
2222

23-
24-
set PATH=E:\Deploy_Deltares\libs;%PATH%
25-
set PYTHONPATH=E:\Deploy_Deltares
26-
set PYTHONHOME=C:\Users\garat\AppData\Local\Programs\Python\Python311
27-
28-
2923
set PATH=%kratos_bin_path%\libs;%PATH%
3024
set PYTHONPATH=%kratos_bin_path%
31-
REM pythonhome is the parent directory of %python_path%
25+
set PYTHONHOME=%python_home%
3226

33-
set PYTHONHOME=""
34-
%python_path% -c "import os; print (os.environ)" > "%2\\%1.1info" 2> "%2\\%1.1err"
3527
REM Run Python using the script MainKratos.py
3628
%python_path% MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err"

kratos.gid/exec/pip.unix.bat

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ rm -f "$2/$1.info"
99
rm -f "$2/$1.err"
1010
rm -f "$2/$1.flavia.dat"
1111

12+
export PYTHONPATH=%python_home%
13+
export PYTHONHOME=%python_home%
14+
1215
# Run Python using the script MainKratos.py
13-
$kratos_python_exe MainKratos.py > "$2/$1.info" 2> "$2/$1.err"
16+
$python_home/python3 MainKratos.py > "$2/$1.info" 2> "$2/$1.err"

kratos.gid/exec/pip.win.bat

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ DEL "%2\%1.err"
1313
DEL "%2\%1*.post.bin"
1414
DEL "%2\%1*.post.res"
1515
DEL "%2\%1*.post.msh"
16-
@REM Calculate!
1716

18-
set PYTHONHOME=""
19-
%python_path% MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err"
17+
set PYTHONPATH=%python_home%
18+
set PYTHONHOME=%python_home%
19+
20+
@REM Calculate!
21+
%python_home%/python.exe MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err"

kratos.gid/scripts/Launch.tcl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ proc Kratos::pipVersion { {pythonExecutable ""} } {
7878
}
7979
set ver 0
8080

81+
catch {
8182
set info [exec $pip -m pip --version 2>@1]
8283
if {[regexp {pip\s+(\d+\.\d+)} $info --> version]} {
8384
set ver $version
8485
}
85-
86+
}
8687

8788
return $ver
8889
}
@@ -205,7 +206,7 @@ proc Kratos::CheckDependenciesPipMode {} {
205206
if {$py_version <= 0} {
206207
set ret "MISSING_PYTHON"
207208
} else {
208-
set pip_version [Kratos::pipVersion $python_exe_path]
209+
set pip_version [Kratos::pipVersion]
209210
if {$pip_version <= 0} {
210211
set ret "MISSING_PIP"
211212
} else {
@@ -292,11 +293,13 @@ proc Kratos::ExecuteLaunchByMode {launch_mode} {
292293
set python_path [Kratos::ManagePreferences GetValue python_path]
293294
set ::env(python_path) $python_path
294295
set kratos_bin_path [Kratos::ManagePreferences GetValue kratos_bin_path]
296+
set ::env(python_home) [file dirname $python_path]
295297
set ::env(kratos_bin_path) $kratos_bin_path
296298
}
297299
{External python} {
298300
set python_path [Kratos::ManagePreferences GetValue python_path]
299301
set ::env(python_path) $python_path
302+
set ::env(python_home) [file dirname $python_path]
300303
}
301304
Default {
302305
set python_path [GiD_Python_GetPythonExe]
@@ -359,4 +362,4 @@ proc Kratos::CreateModeCombo { } {
359362

360363
grid $w -col 9 -row 0 -padx 10 -sticky news
361364

362-
}
365+
}

0 commit comments

Comments
 (0)