[vlc-commits] Fix PyInstaller Windows import issue (#121)

ScamCast git at videolan.org
Mon Apr 6 12:25:51 CEST 2020


vlc/python | branch: master | ScamCast <56202326+ScamCast at users.noreply.github.com> | Sun Mar  8 10:59:44 2020 -0600| [943e80a9adeaa649b3f208de9dc90eeb56ac94ff] | committer: GitHub

Fix PyInstaller Windows import issue (#121)

This fixes the dll import issues in windows when running from a pyinstaller executable.

> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=943e80a9adeaa649b3f208de9dc90eeb56ac94ff
---

 generator/templates/header.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/generator/templates/header.py b/generator/templates/header.py
index 74af574..f3cf460 100755
--- a/generator/templates/header.py
+++ b/generator/templates/header.py
@@ -154,6 +154,9 @@ def find_lib():
                         plugin_path = os.path.dirname(p)
                         break
             if plugin_path is not None:  # try loading
+                 # PyInstaller Windows fix
+                if 'PyInstallerCDLL' in ctypes.CDLL.__name__:
+                    ctypes.windll.kernel32.SetDllDirectoryW(None)
                 p = os.getcwd()
                 os.chdir(plugin_path)
                  # if chdir failed, this will raise an exception



More information about the vlc-commits mailing list