File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/ansys/tools/installer Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -739,13 +739,29 @@ def _run_install_python(self, filename):
739739 self .setEnabled (True )
740740
741741
742+ def __restore_windows_dll_load ():
743+ """PyInstaller on Windows may break DLL loading. This function restores it."""
744+ import sys
745+ LOG .debug (f"sys.platform: { sys .platform } " )
746+ if sys .platform == "win32" :
747+ LOG .debug ("Restoring DLL loading on Windows..." )
748+ import ctypes
749+ ctypes .windll .kernel32 .SetDllDirectoryA (None )
750+
751+
742752def open_gui ():
743753 """Start the installer as a QT Application."""
744754 import argparse
745755 import ctypes
756+
757+ # Enable logging early
758+ enable_logging ()
746759
747760 if os .name == "nt" :
748761 import msvcrt
762+
763+ # Restore DLL loading on Windows...
764+ __restore_windows_dll_load ()
749765
750766 kernel32 = ctypes .windll .kernel32
751767
@@ -776,8 +792,6 @@ def open_gui():
776792 sys .stdout = open ("CONOUT$" , "w" )
777793 sys .stderr = open ("CONOUT$" , "w" )
778794
779- enable_logging ()
780-
781795 app = QtWidgets .QApplication (sys .argv )
782796 window = AnsysPythonInstaller ()
783797
You can’t perform that action at this time.
0 commit comments