Skip to content

Commit

Permalink
Fix PyInstaller Windows import issue (#121)
Browse files Browse the repository at this point in the history
This fixes the dll import issues in windows when running from a pyinstaller executable.
  • Loading branch information
ScamCast authored Mar 8, 2020
1 parent 8e6c723 commit 943e80a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions generator/templates/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 943e80a

Please sign in to comment.