From d247202c1ca8694fe2e9e1b0b6e4c25f27c91225 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Sun, 20 Oct 2019 22:50:41 -0700 Subject: [PATCH] Fix DLL search path on Windows with Python 3.8 Python 3.8 no longer looks for DLLs in the insecure search path, i.e. it ignores %PATH%. Add the necessary directory using os.add_dll_directory() to make this work again. --- tools/w32/add_search_path.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/w32/add_search_path.py b/tools/w32/add_search_path.py index c6eaa910fe..dc9879a70a 100755 --- a/tools/w32/add_search_path.py +++ b/tools/w32/add_search_path.py @@ -39,6 +39,9 @@ def _add_pyext_to_path(): # Add DLL directory to PATH so Windows can find them if dlldir not in os.environ['PATH']: os.environ['PATH'] = dlldir + ';' + os.environ['PATH'] + # Python 3.8 or later don't look in PATH for DLLs + if hasattr(os, 'add_dll_directory'): + __dll_directory = os.add_dll_directory(dlldir) _add_pyext_to_path() """ @@ -60,6 +63,9 @@ def _add_pyext_to_path(): # Add DLL directory to PATH so Windows can find them if dlldir not in os.environ['PATH']: os.environ['PATH'] = dlldir + ';' + os.environ['PATH'] + # Python 3.8 or later don't look in PATH for DLLs + if hasattr(os, 'add_dll_directory'): + __dll_directory = os.add_dll_directory(dlldir) _add_pyext_to_path() """