Skip to content

Commit

Permalink
Windows : Add DLL paths to resolve Python module dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl authored and johnhaddon committed Feb 15, 2024
1 parent a973118 commit 57f5896
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin/__gaffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import sys
import signal
import warnings
import pathlib

# Get rid of the annoying signal handler which turns Ctrl-C into a KeyboardInterrupt exception
signal.signal( signal.SIGINT, signal.SIG_DFL )
Expand All @@ -51,6 +52,14 @@
# to catch all the naughty deprecated things we do.
warnings.simplefilter( "default", DeprecationWarning )

# Make sure we can can find DLLs that are linked into Python modules on Windows.
if hasattr( os, "add_dll_directory" ) :
os.add_dll_directory( ( pathlib.Path( os.environ["GAFFER_ROOT"] ) / "lib" ).resolve() )
for extensionPath in os.environ.get( "GAFFER_EXTENSION_PATHS", "").split( os.pathsep ) :
for dllPath in [ pathlib.Path( extensionPath ) / d for d in [ "bin", "lib" ] ] :
if dllPath.is_dir() :
os.add_dll_directory( dllPath.resolve() )

import IECore

# Increase the soft limit for file handles as high as we can - we need everything we can get for
Expand Down
8 changes: 8 additions & 0 deletions python/IECoreArnold/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
#
##########################################################################

import os
import pathlib

if hasattr( os, "add_dll_directory" ) :
os.add_dll_directory( ( pathlib.Path( os.environ["ARNOLD_ROOT"] ) / "bin" ).resolve() )

del os, pathlib # Don't pollute the namespace

from ._IECoreArnold import *

from .UniverseBlock import UniverseBlock

0 comments on commit 57f5896

Please sign in to comment.