Windows 7 64-bit - Python 2.6 32-bit - Pymunk 4.0.0
Ok, Thanks to Using Pymunk with Pyinstaller . It took me a long time but I now understand how to throw anything I want into an exe with Pyinstaller. However, a particular dll-that is there-still fails to load-chipmunk.dll
.
Heres my .spec file for Pyinstaller.
# -*- mode: python -*-
a = Analysis(['Mesh_Animator.py'],
pathex=['C:\\Users\\username\\workspace\\2D_Mesh_Animator'],
hiddenimports=[],
hookspath=None)
import os, pymunk
pymunk_dir = os.path.dirname(pymunk.__file__)
chipmunk_libs = [
('chipmunk.dll', os.path.join(pymunk_dir, 'chipmunk.dll'), 'BINARY'),
]
a.datas+=[('imagetest.jpg','imagetest.jpg','DATA')]
a.binaries+=chipmunk_libs
#or just
#a.binaries+=[('chipmunk.dll','chipmunk.dll','BINARY')]
#both seem to work the say way
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name=os.path.join('dist', 'Mesh_Animator.exe'),
debug=False,
strip=None,
upx=True,
console=True )
This all packages no problem. The image loads fine as long as I have the dll next to the exe so I dont error. I confirmed the dll was in by comparing before and after versions of including the dll. 160 kb difference. Then I used this to check if the dll was in the current path when launched under Pyinstallers exe environment.
try:
print os.listdir(sys._MEIPASS).count("chipmunk.dll"),"dlls"
except:
#not in pyinstaller
print 0,"dlls"
I get an exact 1 dlls
on output but pymunk complains it couldn't find it. Its in the _MEIPASS PATH
dir so how come pymunk can't find it? The dll is in the root so no searching should be required. How can I get pymunk to search the right location?