From 7e6fa757747e4c4d9baaae81e0f0e7880f8a6471 Mon Sep 17 00:00:00 2001 From: Tristan Laurent <tristan.laurent@cs-soprasteria.com> Date: Fri, 21 Mar 2025 13:54:07 +0100 Subject: [PATCH 1/2] BUG: correct generated ps1 scripts to correctly handle arguments --- CMake/OTBApplicationMacros.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMake/OTBApplicationMacros.cmake b/CMake/OTBApplicationMacros.cmake index 99809f780d..0443afe3b3 100644 --- a/CMake/OTBApplicationMacros.cmake +++ b/CMake/OTBApplicationMacros.cmake @@ -191,9 +191,9 @@ else { $OTB_LAUNCHER = \"${_launcher_type}.ps1\" } -# As we are using another powershell script, execute it with the '. <path>' syntax -# Start application -. \"$OTB_LAUNCHER\" \"${APPLAUNCHER_NAME}\" $args +# As we are using another powershell we need to use InvokeExpression Syntax +# The '&' is to run the script in its own shell without polluting this one +Invoke-Expression \"&'$OTB_LAUNCHER' ${APPLAUNCHER_NAME} $args\" ") else() # Launcher script in Shell format -- GitLab From 8e205797235580a0ccab5910d5748ad5f4aa9a3d Mon Sep 17 00:00:00 2001 From: Tristan Laurent <tristan.laurent@cs-soprasteria.com> Date: Fri, 21 Mar 2025 16:10:15 +0100 Subject: [PATCH 2/2] DOC: improve python usage doc for windows --- Documentation/Cookbook/rst/templates/PythonAPI.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/Cookbook/rst/templates/PythonAPI.rst b/Documentation/Cookbook/rst/templates/PythonAPI.rst index fb6d7a0a89..e915084802 100644 --- a/Documentation/Cookbook/rst/templates/PythonAPI.rst +++ b/Documentation/Cookbook/rst/templates/PythonAPI.rst @@ -20,6 +20,7 @@ that are not installed on your default PYTHONPATH. import os os.add_dll_directory("/Path/To/OTB_INSTALL/lib/otb/python") os.add_dll_directory("/Path/To/OTB_INSTALL/lib/") + os.add_dll_directory("/Path/To/OTB_INSTALL/bin") import otbApplication as otb Once your environment is set, you can use OTB applications from Python, just -- GitLab