From 2c6aea8bb1aeb543d947cfcaff30b57c44d9d75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lo=C3=AFse=20Brosseau?= <54746458+eloisebrosseau@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:18:30 -0500 Subject: [PATCH] Add Python initialization in rvls (#653) ### Add Python initialization in rvls ### Summarize your change. Initialize Python in rvls main function to match the behaviour of rvio inside the ShotGrid license validation. ### Describe the reason for the change. The license validation was failing on Linux when using rvls, but the same code was working fine with rvio because of the Python initialization in main(). The Python interpreter from rvio had more capabilities that were needed to properly import Python modules on Linux. ### Describe what you have tested and on which operating system. This change was tested on Rocky8, MacOS Sonoma and Windows 11. Co-authored-by: Bernard Laberge <117092886+bernie-laberge@users.noreply.github.com> --- src/bin/imgtools/rvls/CMakeLists.txt | 2 ++ src/bin/imgtools/rvls/main.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/bin/imgtools/rvls/CMakeLists.txt b/src/bin/imgtools/rvls/CMakeLists.txt index 883320e74..f1cbe5df1 100644 --- a/src/bin/imgtools/rvls/CMakeLists.txt +++ b/src/bin/imgtools/rvls/CMakeLists.txt @@ -30,6 +30,7 @@ FIND_PACKAGE( TARGET_LINK_LIBRARIES( ${_target} + PUBLIC MuTwkApp PRIVATE IOproxy OpenEXR::OpenEXR MovieFB @@ -45,6 +46,7 @@ TARGET_LINK_LIBRARIES( Boost::headers yaml_cpp Qt5::Core + PyTwkApp ) IF(RV_TARGET_DARWIN) diff --git a/src/bin/imgtools/rvls/main.cpp b/src/bin/imgtools/rvls/main.cpp index 4ad4255f6..6e1ed47fd 100644 --- a/src/bin/imgtools/rvls/main.cpp +++ b/src/bin/imgtools/rvls/main.cpp @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include #include @@ -676,6 +678,17 @@ int utf8Main(int argc, char** argv) TwkMovie::GenericIO::addPlugin(new MovieFBIO()); TwkMovie::GenericIO::addPlugin(new MovieProceduralIO()); + try + { + TwkApp::initMu(nullptr); + TwkApp::initPython(); + } + catch (const std::exception &e) + { + cerr << "ERROR: during initialization: " << e.what() << '\n'; + exit(-1); + } + if (showFormats) { TwkMovie::GenericIO::outputFormats();