M
Massi
I everyone,
I'm trying to write a setup file for py2exe (0.6.9) to convert my
script into a windows (on win 7) executable. In my script (python2.6)
I use PyQt and matplotlib. Here is the setup.py file:
from distutils.core import setup
import py2exe
import matplotlib as mpl
import glob, shutil
mpl.use('qt4agg')
shutil.rmtree("build", ignore_errors=True)
includes = ['sip', 'PyQt4', 'PyQt4.QtGui', 'matplotlib.backends',
"win32com", "win32service", "win32serviceutil",
"win32event",
"sqlalchemy.dialects.mssql", "pyodbc", "datetime",
"decimal",
"sqlalchemy.dialects.mysql", "MySQLdb"]
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter', 'pydoc', 'doctest', 'test',
'wx']
packages = ['matplotlib', 'pytz', "encodings"]
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll',
'tcl84.dll',
"libgdk_pixbuf-2.0-0.dll", 'tk84.dll']
data_files = mpl.get_py2exe_datafiles()
setup(name="MyProg",
windows=[{"script": 'Main.pyw',
"icon_resources": [(1, "colorrulex.ico")]}],
options = {"py2exe": {"compressed":2, "optimize":2,
"includes":includes,
"excludes": excludes, "packages":
packages,
"dll_excludes": dll_excludes,
"bundle_files":2,
"dist_dir":'dist', "xref":False,
"skip_archive":False, "ascii": False,
"custom_boot_script":''}},
zipfile = r'lib\library.zip',
data_files=data_files
)
If I run 'python setup.py py2exe' at the command line the executable
is successfully created, but when I run MyProg.exe I get the following
error:
Traceback (most recent call last):
File "Main.pyw", line 4, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "gui\tree\ComponentTree.pyo", line 2, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "gui\stage\Item.pyo", line 6, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "components\CompDataView.pyo", line 10, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "components\dataview\PlotPanel.pyo", line 2, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "plot\PlotCanvas.pyo", line 8, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "pylab.pyo", line 1, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "matplotlib\pylab.pyo", line 263, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "matplotlib\pyplot.pyo", line 95, in <module>
File "matplotlib\backends\__init__.pyo", line 25, in pylab_setup
File "zipextimporter.pyo", line 82, in load_module
File "matplotlib\backends\backend_tkagg.pyo", line 8, in <module>
ImportError: No module named Tkinter
Obviously Tkinter is not imported since I'm using pyqt, so can anyone
point me out what I'm doing wrong?
Thanks in advance!
I'm trying to write a setup file for py2exe (0.6.9) to convert my
script into a windows (on win 7) executable. In my script (python2.6)
I use PyQt and matplotlib. Here is the setup.py file:
from distutils.core import setup
import py2exe
import matplotlib as mpl
import glob, shutil
mpl.use('qt4agg')
shutil.rmtree("build", ignore_errors=True)
includes = ['sip', 'PyQt4', 'PyQt4.QtGui', 'matplotlib.backends',
"win32com", "win32service", "win32serviceutil",
"win32event",
"sqlalchemy.dialects.mssql", "pyodbc", "datetime",
"decimal",
"sqlalchemy.dialects.mysql", "MySQLdb"]
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter', 'pydoc', 'doctest', 'test',
'wx']
packages = ['matplotlib', 'pytz', "encodings"]
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll',
'tcl84.dll',
"libgdk_pixbuf-2.0-0.dll", 'tk84.dll']
data_files = mpl.get_py2exe_datafiles()
setup(name="MyProg",
windows=[{"script": 'Main.pyw',
"icon_resources": [(1, "colorrulex.ico")]}],
options = {"py2exe": {"compressed":2, "optimize":2,
"includes":includes,
"excludes": excludes, "packages":
packages,
"dll_excludes": dll_excludes,
"bundle_files":2,
"dist_dir":'dist', "xref":False,
"skip_archive":False, "ascii": False,
"custom_boot_script":''}},
zipfile = r'lib\library.zip',
data_files=data_files
)
If I run 'python setup.py py2exe' at the command line the executable
is successfully created, but when I run MyProg.exe I get the following
error:
Traceback (most recent call last):
File "Main.pyw", line 4, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "gui\tree\ComponentTree.pyo", line 2, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "gui\stage\Item.pyo", line 6, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "components\CompDataView.pyo", line 10, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "components\dataview\PlotPanel.pyo", line 2, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "plot\PlotCanvas.pyo", line 8, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "pylab.pyo", line 1, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "matplotlib\pylab.pyo", line 263, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "matplotlib\pyplot.pyo", line 95, in <module>
File "matplotlib\backends\__init__.pyo", line 25, in pylab_setup
File "zipextimporter.pyo", line 82, in load_module
File "matplotlib\backends\backend_tkagg.pyo", line 8, in <module>
ImportError: No module named Tkinter
Obviously Tkinter is not imported since I'm using pyqt, so can anyone
point me out what I'm doing wrong?
Thanks in advance!