Skip to content

Commit

Permalink
Adjust Windows DLL search path for Python 3.8+
Browse files Browse the repository at this point in the history
Fixes #1439

Required by python/cpython#80266
  • Loading branch information
JGamache-autodesk committed Aug 4, 2023
1 parent c34a106 commit bc93756
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions python/MaterialX/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Python 3.8+ on Windows: DLL search paths for dependent
# shared libraries
# Refs.:
# - https://github.com/python/cpython/issues/80266
# - https://docs.python.org/3.8/library/os.html#os.add_dll_directory
import os
import sys
if sys.platform == "win32" and sys.version_info >= (3, 8):
# On a standard installation, this file is in %INSTALLDIR%\python\MaterialX
# We need to add %INSTALLDIR%\bin to the DLL path.
mxdir = os.path.dirname(__file__)
pydir = os.path.split(mxdir)[0]
installdir = os.path.split(pydir)[0]
bindir = os.path.join(installdir, "bin")
if os.path.exists(bindir):
os.add_dll_directory(bindir)

from .main import *
from .colorspace import *

Expand Down

0 comments on commit bc93756

Please sign in to comment.