2
votes

I have a problem when trying to make an executable with a Python application.

For doing this, I'm using Py2exe with the 2.7 version of Python.

My application have 3 python scripts -> IHM_monotone_flux_GTC.py which is the one who launch a graphical interface

and then 2 others scripts: -> lectureDonnees.py -> main.py

In order to create an executable I made a setup.py file which is surely incomplete:

from distutils.core import setup import py2exe

setup(windows=['IHM_monotone_flux_gtc.py'])

Unfortunetaly, it doesn't work and I got this error message:

Traceback (most recent call last):
     File "IHM_monotone_flux_gtc.py", line 16, in <module>
     File "main.pyc", line 22, in <module>
     File "matplotlib\__init__.pyc", line 838, in <module>
     File "matplotlib\__init__.pyc", line 749, in rc_params
     File "matplotlib\__init__.pyc", line 664, in matplotlib_fname
     File "matplotlib\__init__.pyc", line 292, in wrapper
     File "matplotlib\__init__.pyc", line 585, in _get_data_path_cached
     File "matplotlib\__init__.pyc", line 581, in _get_data_path
   RuntimeError: Could not find the matplotlib data files

Thanks for any help. (I'm working with Windows XP)

Cédric.

1

1 Answers

4
votes

You will need to copy the mpl-data folder too. Check this official wiki site http://www.py2exe.org/index.cgi/MatPlotLib

import matplotlib
...
setup(
    ...
    data_files=matplotlib.get_py2exe_datafiles(),
)

You will need something like this in your setup.py for py2exe. hope it helps.