1616import shutil
1717import zipfile
1818import pprint
19+ import re
1920import subprocess
2021import zipfile
2122
@@ -830,7 +831,8 @@ def ensure_plugin_ready(
830831 logger = logging .getLogger (__file__ )
831832 logger .setLevel (logging .DEBUG )
832833
833- alias_python_exe = None
834+ alias_python_supported = False
835+ server_python_exe = None
834836
835837 if version_cmp (alias_version , "2024.0" ) >= 0 :
836838 # Alias >= 2024.0
@@ -843,18 +845,23 @@ def ensure_plugin_ready(
843845
844846 if version_cmp (alias_version , "2027.1" ) >= 0 :
845847 # Alias >= 2027.1 now supports Python and ships python interpreter.
846- alias_python_exe = os .path .join (sys .executable , "Python" , "python.exe" )
847- if not os .path .exists (alias_python_exe ):
848- alias_python_exe = None
848+ alias_python_supported = True
849+ alias_bin_path = os .path .dirname (alias_exec_path )
850+ alias_python_dir = os .path .join (alias_bin_path , "Python" )
851+ if not os .path .exists (alias_python_dir ):
849852 raise Exception (
850- f"Failed to find Alias Python interpreter at { alias_python_exe } "
853+ f"Could not find Alias Python directory at { alias_python_dir } "
854+ )
855+ for filename in os .listdir (alias_python_dir ):
856+ match = re .match (r"python(\d)(\d+)\.dll" , filename )
857+ if match :
858+ py_major_version = int (match .group (1 ))
859+ py_minor_version = int (match .group (2 ))
860+ break
861+ else :
862+ raise Exception (
863+ f"Could not determine Alias Python version from { alias_python_dir } "
851864 )
852- result = subprocess .run (
853- [alias_python_exe , "--version" ], capture_output = True , text = True
854- )
855- version_string = result .stdout .strip () # e.g. "Python 3.12.0"
856- py_major_version = int (version_string .split (" " )[1 ].split ("." )[0 ])
857- py_minor_version = int (version_string .split (" " )[1 ].split ("." )[1 ])
858865 elif version_cmp (alias_version , "2026.0" ) >= 0 :
859866 # Alias >= 2026.0 has removed dependency on Qt/PySide for the FPT plugin
860867 py_major_version = 3
@@ -867,14 +874,11 @@ def ensure_plugin_ready(
867874 py_major_version = 3
868875 py_minor_version = 7
869876
870- install_python_packages = os .environ .get (
871- "SHOTGRID_ALIAS_INSTALL_PYTHON_PACKAGES"
872- ) in ("1" , "true" , "True" )
877+ if not alias_python_supported :
878+ install_python_packages = os .environ .get (
879+ "SHOTGRID_ALIAS_INSTALL_PYTHON_PACKAGES"
880+ ) in ("1" , "true" , "True" )
873881
874- if alias_python_exe :
875- # Use the Alias Python interpreter
876- server_python_exe = alias_python_exe
877- else :
878882 # Use the framework's Python interpreter (installed for user)
879883 server_python_exe = ensure_python_installed (
880884 py_major_version ,
@@ -895,7 +899,9 @@ def ensure_plugin_ready(
895899 # version.
896900 ensure_python_packages_installed (logger = logger )
897901
898- if not alias_python_exe :
902+ if alias_python_supported :
903+ plugin_lst_path = None
904+ else :
899905 # For Alias < 2027.1, pre-python support we use C++ compiled plugin
900906 # Get the file path to the .lst file that contains the file path to the Alias Plugin to
901907 # load at startup with Alias.
0 commit comments