title: EXE made with PyInstaller can't load libvlc.dll (python-vlc)
body: <p>I'm trying to package a python script which uses python-vlc using pyinstaller, but the resulting .exe refuses to recognize the libvlc.dll binary file. I always get the same error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;ctypes\__init__.py&quot;, line 381, in __init__
  OSError: [WinError 193] %1 is not a valid Win32 application
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File &quot;vlc-test.py&quot;, line 3, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 991, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 975, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 671, in _load_unlocked
    File &quot;PyInstaller\loader\pyimod03_importers.py&quot;, line 495, in exec_module
    File &quot;vlc.py&quot;, line 210, in &lt;module&gt;
    File &quot;vlc.py&quot;, line 170, in find_lib
    File &quot;PyInstaller\loader\pyimod04_ctypes.py&quot;, line 55, in __init__
  pyimod04_ctypes.PyInstallerImportError: Failed to load dynlib/dll '.\\libvlc.dll'. Most likely this dynlib/dll was not found when the application was frozen.
  [2236] Failed to execute script 'vlc-test' due to unhandled exception!
  </code></pre>
  <p>Which seems to be a problem others have fixed by including either binary or data files in the spec file. Nothing I add to the spec file makes any difference, though. Here's where it is now, I've even included Windows system dlls that the VLC one depends on:</p>
  <pre><code># -*- mode: python ; coding: utf-8 -*-
  
  block_cipher = None
  
  a = Analysis(['vlc-test.py'],
               pathex=[&quot;D:\\GitHub\\hours&quot;, &quot;C:\\Users\\zacha\\anaconda3\\envs\\hours\\Lib\\site-packages&quot;],
               binaries=[(&quot;C:\\Program Files (x86)\\VideoLAN\\VLC\\libvlc.dll&quot;,&quot;.&quot;),
                  (&quot;C:\\Program Files (x86)\\VideoLAN\\VLC\\libvlccore.dll&quot;,&quot;.&quot;),
                  (&quot;C:\\Program Files (x86)\\VideoLAN\\VLC\\axvlc.dll&quot;,&quot;.&quot;),
                  (&quot;C:\\Program Files (x86)\\VideoLAN\\VLC\\npvlc.dll&quot;,&quot;.&quot;),
                  (&quot;C:\\Windows\\SysWOW64\\advapi32.dll&quot;,&quot;.&quot;),
                  (&quot;C:\\Windows\\SysWOW64\\kernel32.dll&quot;,&quot;.&quot;),
                  (&quot;C:\\Windows\\SysWOW64\\MSVCRT.dll&quot;,&quot;.&quot;),
                  ],
               datas=[('./libvlc.dll', '.'), ('./axvlc.dll', '.'), ('./libvlccore.dll', '.'), ('./npvlc.dll', '.')],
               hiddenimports=[],
               hookspath=[],
               hooksconfig={},
               runtime_hooks=[],
               excludes=[],
               win_no_prefer_redirects=False,
               win_private_assemblies=False,
               cipher=block_cipher,
               noarchive=False)
  
  a.datas += Tree(&quot;C:\\Program Files (x86)\\VideoLAN\\VLC\\plugins&quot;, prefix='plugins')
  pyz = PYZ(a.pure, a.zipped_data,
               cipher=block_cipher)
  
  exe = EXE(pyz,
            a.scripts, 
            [],
            exclude_binaries=True,
            name='vlc-test',
            debug=False,
            bootloader_ignore_signals=False,
            strip=False,
            upx=True,
            console=True,
            disable_windowed_traceback=False,
            target_arch=None,
            codesign_identity=None,
            entitlements_file=None )
  coll = COLLECT(exe,
                 a.binaries,
                 a.zipfiles,
                 a.datas, 
                 strip=False,
                 upx=True,
                 upx_exclude=[],
                 name='vlc-test')
  </code></pre>
  <p>All the files listed under binaries do indeed appear in the dist folder, so I don't think it's a formatting issue. I'm using 32-bit versions of both Python and VLC. Is there anything else I can try before giving up?</p>
  <p>Windows 11, Python 3.8.8, pyinstaller 4.9</p>