Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MemoryLoadError when trying to run py2exe application

I am attempting to bundle up a Python application using py2exe 0.6.9 and Python 2.6.4 on Windows. While the executable runs just fine on the system I used to build it, it fails when I attempt to run it on another system:

C:\Documents and Settings\Administrator\Desktop\dist>.\backend.exe install
Traceback (most recent call last):
  File "boot_service.py", line 6, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "win32serviceutil.pyo", line 9, in <module>
  File "zipextimporter.pyo", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading win32api.pyd

I have a strong hunch that I'm missing a library, but I'm unsure which—especially since the dependency checker isn't flagging anything as missing on the target system. How should I proceed?

like image 874
Benjamin Pollack Avatar asked Jan 20 '10 20:01

Benjamin Pollack


2 Answers

same question as https://stackoverflow.com/questions/1979486/py2exe-win32api-pyc-importerror-dll-load-failed.

look at setup.py, just excludes these dlls which are included in the system.

 'dll_excludes': [ "mswsock.dll", "powrprof.dll" ]

it will help you!

like image 159
istonelee Avatar answered Sep 18 '22 22:09

istonelee


You can do the dll and dependency check manually. When you generate the exe i am sure you have noticed that it prints out the dll's that are required/used. Check on the system, where the exe is not working, if the dll's exist and if they are the same version.

One other thing. Are you copying the whole dist folder to the system or just the exe, because you need the whole dist folder and not just the exe.

like image 44
Paul Avatar answered Sep 18 '22 22:09

Paul