using py2exe with wxPython and Matplotlib

Viewed 5849

I'm trying to generate an .exe file from a python script that uses wxPython and Matplotlib and it looks like to be impossible.

The imports I'm doing (related with Matplotlib) are the following:

from numpy import *
import matplotlib
matplotlib.interactive(True)
matplotlib.use("WXAgg")
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas
from matplotlib.ticker import MultipleLocator

Here is the setup.py file I'm trying to use:

from distutils.core import setup
import py2exe
import matplotlib

opts = {
'py2exe': {"bundle_files" : 3,
           "includes" : [ "matplotlib", 
            "matplotlib.backends",  
            "matplotlib.backends.backend_wxagg",
                        "numpy", 
                        "matplotlib.ticker",
                        "matplotlib.figure", "_wxagg"],
            'excludes': ['_gtkagg', '_tkagg', '_agg2', 
                        '_cairo', '_cocoaagg',
                        '_fltkagg', '_gtk', '_gtkcairo', ],
            'dll_excludes': ['libgdk-win32-2.0-0.dll',
                        'libgobject-2.0-0.dll']
          }
   }

setup(


  windows=[{'script':'starHunter.py', 'icon_resources':[(1, 'icon.ico')]}],

  data_files=matplotlib.get_py2exe_datafiles(),

  options=opts,

  zipfile=None
)

I'm always getting "Could not find matplotlib data files" after trying to run the .exe file, which by the way, is successfully created.

Additional information: I'm using Python 2.6, Matplotlib 0.99.3, wxPython 2.8.11.0 on Windows XP

Thanks in advance. Any help will be appreciated!

Cheers, Andressa Sivolella

4 Answers
Related