Skip to content

Commit

Permalink
Add Python initialization in rvls (#653)
Browse files Browse the repository at this point in the history
### 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 <[email protected]>
  • Loading branch information
eloisebrosseau and bernie-laberge authored Dec 12, 2024
1 parent 82d3efd commit 2c6aea8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/bin/imgtools/rvls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ FIND_PACKAGE(

TARGET_LINK_LIBRARIES(
${_target}
PUBLIC MuTwkApp
PRIVATE IOproxy
OpenEXR::OpenEXR
MovieFB
Expand All @@ -45,6 +46,7 @@ TARGET_LINK_LIBRARIES(
Boost::headers
yaml_cpp
Qt5::Core
PyTwkApp
)

IF(RV_TARGET_DARWIN)
Expand Down
13 changes: 13 additions & 0 deletions src/bin/imgtools/rvls/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <IOproxy/IOproxy.h>
#include <ImfThreading.h>
#include <MovieFB/MovieFB.h>
#include <MuTwkApp/MuInterface.h>
#include <PyTwkApp/PyInterface.h>
#include <TwkFB/TwkFBThreadPool.h>
#include <MovieProcedural/MovieProcedural.h>
#include <MovieProxy/MovieProxy.h>
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 2c6aea8

Please sign in to comment.