title: ImportError: DLL Load failed (PyCrypto-2.6.1)
body: <p>I'm using PyInstaller to convert the python file with the included modules to one Executable file with the following command:
  <code>pyinstaller --onedir --onefile --name=IFSCP "C:\Python27\main.py"</code>
  <em>I'm not using prefix --windowed, because the Python Program is in console mode.</em></p>
  
  <p>Everything went fine with compiling, but there is one issue while opening the executable. The following error comes up by loading the executable:</p>
  
  <pre><code>Traceback (most recent call last):
   File "main.py", line 13 in &lt;module&gt;
   File "C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
       exec(bytecode, module, __dict__)
   File "c:\users\yourik~1\appdata\local\temp\easy_install-gzievh\pycrypto-2.6.1-py2.7-win32.egg.tmp\Crypto\Cipher\AES.py", line 50, in &lt;module&gt;
   File "C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
       exec(bytecode, module, __dict__)
   File "c:\users\yourik~1\appdata\local\temp\easy_install-gzievh\\pycrypto-2.6.1-py2.7-win32.egg.tmp\Crypto\Cipher\_AES.py", line 7 in &lt;module&gt;
   File "c:\users\yourik~1\appdata\local\temp\easy_install-gzievh\\pycrypto-2.6.1-py2.7-win32.egg.tmp\Crypto\Cipher\_AES.py", line 6 in __bootstrap__
  </code></pre>
  
  <p>ImportError: DLL load failed: Kan opgegeven module niet vinden. </p>
  
  <p><em>Kan opgegeven module niet vinden. -> Can't find module</em></p>
  
  <p>The ImportError don't show up without the
  <code>from Crypto.Cipher import AES</code>
  in the script. </p>
  
  <p>Debug info:</p>
  
  <pre><code>C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\IFSCP\dist&gt;IFSCP.exe
  
  PyInstaller Bootloader 3.x
  LOADER: executable is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5
  d\IFSCP\dist\IFSCP.exe
  LOADER: homepath is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\
  IFSCP\dist
  LOADER: _MEIPASS2 is NULL
  LOADER: archivename is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a
  5d\IFSCP\dist\IFSCP.exe
  LOADER: Extracting binaries
  LOADER: Executing self as child
  LOADER: set _MEIPASS2 to C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522
  LOADER: Setting up to run child
  LOADER: Creating child process
  LOADER: Waiting for child process to finish...
  PyInstaller Bootloader 3.x
  LOADER: executable is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5
  d\IFSCP\dist\IFSCP.exe
  LOADER: homepath is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\
  IFSCP\dist
  LOADER: _MEIPASS2 is C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522
  LOADER: archivename is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a
  5d\IFSCP\dist\IFSCP.exe
  LOADER: SetDllDirectory(C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522)
  LOADER: Already in the child - running user's code.
  LOADER: manifestpath: C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522\IFSCP.exe.m
  anifest
  LOADER: Activation context created
  LOADER: Activation context activated
  LOADER: Python library: C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522\python27.
  dll
  LOADER: Loaded functions from Python library.
  LOADER: Manipulating environment (sys.path, sys.prefix)
  LOADER: sys.prefix is C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60~1
  LOADER: Setting runtime options
  LOADER: Bootloader option: pyi-windows-manifest-filename IFSCP.exe.manifest
  LOADER: Initializing python
  LOADER: Overriding Python's sys.path
  LOADER: Post-init sys.path is C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522
  LOADER: Setting sys.argv
  LOADER: setting sys._MEIPASS
  LOADER: importing modules from CArchive
  LOADER: extracted struct
  LOADER: callfunction returned...
  LOADER: extracted pyimod01_os_path
  LOADER: callfunction returned...
  LOADER: extracted pyimod02_archive
  LOADER: callfunction returned...
  LOADER: extracted pyimod03_importers
  LOADER: callfunction returned...
  LOADER: Installing PYZ archive with Python modules.
  LOADER: PYZ archive: out00-PYZ.pyz
  LOADER: Running pyiboot01_bootstrap.py
  LOADER: Running pyi_rth_pkgres.py
  LOADER: Running pyi_rth__tkinter.py
  LOADER: Running main.py
  Traceback (most recent call last):
    File "main.py", line 13, in &lt;module&gt;
    File "C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\PyInstaller\
  loader\pyimod03_importers.py", line 389, in load_module
      exec(bytecode, module.__dict__)
    File "c:\users\yourik~1\appdata\local\temp\easy_install-gzievh\pycrypto-2.6.1-
  py2.7-win32.egg.tmp\Crypto\Cipher\_AES.py", line 7, in &lt;module&gt;
    File "c:\users\yourik~1\appdata\local\temp\easy_install-gzievh\pycrypto-2.6.1-
  py2.7-win32.egg.tmp\Crypto\Cipher\_AES.py", line 6, in __bootstrap__
  ImportError: DLL load failed: Kan opgegeven module niet vinden.
  Failed to execute script main
  LOADER: OK.
  LOADER: Cleaning up Python interpreter.
  LOADER: Back to parent (RC: -1)
  LOADER: Doing cleanup
  LOADER: Freeing archive status for C:\Users\Youri Kool\Desktop\pyinstaller-pyins
  taller-8689a5d\IFSCP\dist\IFSCP.exe
  </code></pre>
  
  <p>I installed the following applications:</p>
  
  <ul>
  <li>Pywin32 version 220</li>
  <li>cx-Freeze version 4.3.4</li>
  <li>PyCrypto version 2.6.1</li>
  </ul>
  
  <p>Pyinstaller pyinstaller-pyinstaller-8689a5d (Developer) and PyInstaller-3.2 giving the same error.</p>