From 4b682edde90809f510386b64911213e87855cca3 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 25 Sep 2024 15:28:53 +0200 Subject: [PATCH 1/2] Cleanup Python snippet required to run Python bindings on Windows --- doc/cmake-options.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/cmake-options.md b/doc/cmake-options.md index 3cb4d93f7..beb0e5f6e 100644 --- a/doc/cmake-options.md +++ b/doc/cmake-options.md @@ -372,7 +372,12 @@ Furthermore, due to Python ignoring the directories in `PATH`, before running py ~~~python import os -os.add_dll_directory(os.path.join(os.environ['ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX'], 'bin')) +import platform + +if platform.system() == "Windows": + superbuild_dll_path = os.path.join(os.environ.get('ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX',""), 'bin') + if (os.exists(superbuild_dll_path)): + os.add_dll_directory(superbuild_dll_path) ~~~ see https://github.com/robotology/robotology-superbuild/issues/1268 for more details. From a0ab067602aaf7761e73a68b7f417aed4c7e6925 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 25 Sep 2024 15:49:11 +0200 Subject: [PATCH 2/2] Apply suggestions --- doc/cmake-options.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/cmake-options.md b/doc/cmake-options.md index beb0e5f6e..af3163fd5 100644 --- a/doc/cmake-options.md +++ b/doc/cmake-options.md @@ -372,9 +372,8 @@ Furthermore, due to Python ignoring the directories in `PATH`, before running py ~~~python import os -import platform -if platform.system() == "Windows": +if os.name == "nt": superbuild_dll_path = os.path.join(os.environ.get('ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX',""), 'bin') if (os.exists(superbuild_dll_path)): os.add_dll_directory(superbuild_dll_path)