Question

i have created an exe from py2exe. After successfully creating the exe, i got the following error when i run main.exe.

  File "_mssql.pyc", line 12, in <module>
  File "_mssql.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.

I am using pymssql module for sql server.

Was it helpful?

Solution

make sure you include the module under the options dictionary. I think it also needs a dll file called ntwdblib.dll. you can find that file and include it into your setup.py.

import os, pymssql
from distutils.core import setup
import py2exe
dll = []
dll.append(os.path.join(os.path.split(pymssql.__file__)[0], 'ntwdblib.dll'))
pyops = {"includes": ['decimal']}
setup(console=['app.py'], options={"py2exe": pyops}, data_files=dll)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top