I’ve got a Python 2.7 program that imports win32clipboard. I tried to freeze it with cx_Freeze 4.2.3 on Windows XP SP3 32-bit, to create an installation MSI. I made a setup.py according to the cx_Freeze documentation, and used the following command:
c:\python27\python.exe setup.py bdist_msi
When I run it on another PC that doesn’t have Python 2.7 installed, I get an exception on the line that imports win32clipboard:
ImportError: DLL load failed: The specified module could not be found.
I can see that win32clipboard.pyd is being included in the build.
What dependency is missing, and how can I ensure it is included?
I eventually figured that
win32clipboard.pydis being included, however,win32clipboard.pyddepends onpywintypes27.dll, which cx_Freeze is not copying fromc:\windows\system32.The short-term hack is to manually copy
c:\windows\system32\pywintypes27.dllintobuild\exe.win32-2.7, then runsetup.py bdist_msiagain.An improved hack is to use the following in the setup.py:
(It would be preferable for cx_Freeze to be improved to automatically detect the
pywintype27.dlldependency, but I guess that’s always a work-in-progress.)