0

After creating an exe of a script (the script was working on its own) with py2exe I got the following error:

Traceback (most recent call last): File "script.py", line 3, in <module> File "zipextimporter.pyc", line 167, in exec_module File "src\import_clixml.pyc", line 1, in <module> File "zipextimporter.pyc", line 150, in create_module ImportError: MemoryLoadLibrary failed loading win32crypt.pyd: The specified module could not be found. (126) 

Which was weird, because I compiled a different script using the exact same library and there it worked just fine. It didn't even work when bundle_files = 3 option was used and the file was clearly available in the location the exe was searching in. It also used to work fine with Python 3.10 and old way of creating exes (distutils and python setup.py)

MCVE:

Python 3.11

py2exe 0.13

script.py

import win32crypt 

setup.py

import py2exe py2exe.freeze( windows=[ { "script": "script.py", } ], ) 

Running the setup.py creates an exe, but trying to run it results in an immediate error with import win32crypt not found error.

2 Answers 2

0

For some unexplicable reason, adding import pandas to the script makes the created exe work correctly, even though the modules should have no effect on each other.

Sign up to request clarification or add additional context in comments.

Comments

0

same question as 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!

1 Comment

Hi, sadly that's not the same error and your suggestion does not solve the issue. In my case the error is visible even on the machine the script was compiled on.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.