Failed to load dynlib / dll Pyinstaller: Error

0

I am working with Python 2.7 and I am deploying it to .exe through PyInstaller, my application connects to an inventory and management system called Contpaqi Comercial and I use a dll that is in this route: 'C: \ Program Files (x86) \ Compac \ COMERCIAL \ MGWServicios.dll ', everything works fine in the code but when I deploy it to .exe it does not work anymore and it only sends me this error:

Traceback (most recent call last):   File "test.py", line 12, in   File "site-packages \ PyInstaller \ loader \ pyiboot01_bootstrap.py", line 174, in __init__ __main __. PyInstallerImportError: Failed to load dynlib / dll 'MGWServices.dll'. Most likely this dynlib / dll was not found when the application was frozen. [1812] Failed to execute script test

The dll I bring it by means of this code:

import ctypes
import os
import sys


ruta = unicode('C:\Program Files (x86)\Compac\COMERCIAL')

ctypes.windll.kernel32.SetCurrentDirectoryW(ruta)

sdkContpaq= ctypes.WinDLL('MGWServicios.dll')

And this is my file.spec:

block_cipher = None


a = Analysis(['test.py'],
         pathex=['C:\myapp'],
         binaries=[],
         datas=[],
         hiddenimports=[],
         hookspath=[],
         runtime_hooks=[],
         excludes=[],
         win_no_prefer_redirects=False,
         win_private_assemblies=True,
         cipher=block_cipher,
         noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
         cipher=block_cipher)
exe = EXE(pyz,
      a.scripts,
      a.binaries,
      a.zipfiles,
      a.datas,
      [],
      name='test',
      debug=False,
      bootloader_ignore_signals=False,
      strip=False,
      upx=True,
      runtime_tmpdir=None,
      console=True)
    
asked by Antonio Pacheco 05.11.2018 в 21:50
source

0 answers