Error LoadLibrary (pythondll) using py2exe tutorials

I am trying to use py2exe and now I am just having problems creating the samples and tutorials that come with py2exe. I run setup.py and that is fine, but when I try to run the exe that is being created, I get the error "LoadLibrary (pythondll) failed". I have not moved exe from the dist directory, and I see that python27.dll is in this dist directory. Does anyone know what could happen?

In case that matters, I am running 32-bit python 2.7 with the corresponding 32-bit python 2.7 py2exe on Windows 7.

thanks

The test.py file just contains print "test"

Here my setup.py is based on what Kirk wrote:

from distutils.core import setup import py2exe import sys from glob import glob project_folder = r'C:\\Python27\\Lib\site-packages\\py2exe\\samples\\test\\' data_files = [ ("dlls", glob(project_folder + r'dlls\\*.dll')) ,("pyds", glob(project_folder + r'pyds\\*.pyd')) ] options = { } setup( name='test' ,options = options ,zipfile = None ,data_files=data_files ,console=['test.py'] ) 
+4
source share
1 answer

You will need to specify the python27.dll file. If you include a few things, use glob and an array of data files as shown below to get the best results with py2exe. In this example, create the Dll folder and put python27.dll there.

 from distutils.core import setup import py2exe import sys from glob import glob data_files = [ ("Stuff", glob(r'C:\projectfolder\Stuff\*.*')) ,("dlls", glob(r'C:\projectfolder\dlls\*.dll')) ,("pyds", glob(r'C:\projectfolder\pyds\*.pyd')) ] options = { } setup( name='ProjectName' ,options = options ,zipfile = None ,data_files=data_files ,console=['projectname.py'] ) 
+1
source

All Articles