I've had similar problems when building executables for Windows and Linux machines. Within your setup.py script you'll need to package up the MySQL module so that it gets distributed along with the rest of your source code.
Try googling py2app with the MySQL module to see if results come up, as different packages require different steps to get them to play nice with py2exe (in my case). Here's an example of my setup.py script for making matplotlib distributable:
Code: ( text )
#!/usr/bin/python
import sys
try:
# if this doesn't work, try import modulefinder
import py2exe.mf as modulefinder
import win32com
for p in win32com.__path__[1:]:
modulefinder.AddPackagePath("win32com", p)
for extra in ["win32com.shell"]: #,"win32com.mapi"
__import__(extra)
m = sys.modules[extra]
for p in m.__path__[1:]:
modulefinder.AddPackagePath(extra, p)
except ImportError:
# no build path setup, no worries.
pass
from distutils.core import setup
from distutils.filelist import findall
import matplotlib
import py2exe
import os
manifest = """[redacted for length]"""
mpdatadir = matplotlib.get_data_path()
mpdata = findall(mpdatadir)
dataFiles = []
for f in mpdata:
dir = os.path.join('matplotlibdata', f[len(mpdatadir)+1:])
dataFiles.append((os.path.split(dir)[0], [f]))
setup(
zipfile = None,
# We use os.path.join for portability
package_dir = {'': os.path.join('..', 'Common')},
py_modules = [ """[redacted, my own modules]""" ],
options={
'py2exe': {
'packages' : ['matplotlib.numerix', 'pytz',
'matplotlib.backends.backend_tkagg'],
'includes': 'matplotlib.numerix.random_array',
'excludes': ['_gtkagg', '_tkagg'],
'dll_excludes':['libgdk-win32-2.0-0.dll',
'libgobject-2.0-0.dll',
'MSVCP80.dll',
'MSVCR80.dll']
}
},
data_files = dataFiles,
windows = [
{
"script": "[redacted]",
"icon_resources": [(1, "iconJ.ico")],
"other_resources": [(24,1,manifest)]
}
],
)
I had to do this different ways for different modules.
Some simply needed to be imported into the setup.py script.
Some needed to use the modulefinder in the beginning (but only matplotlib that I found)
Others simply needed to be included in the packages or includes lists that are part of the py2exe dictionary. I would try doing the import method first, then the packages/includes list entries. But of course that's if a quick google doesn't turn anything up!
As a last resort there may be some similar modulefinder (py2exe.mf) within py2app that you could try out