cx_freeze and matplotlib

Flavio fccoelho at gmail.com
Sat May 13 19:03:16 EDT 2006


I am trying to freeze an application which imports matplotlib. It all
works fine on the machine where it was frozen. The executable runs
without a glitch.

But when I move the directory containing the frozen executable and
other libs to a new machine, I get the following error:

Traceback (most recent call last):
 File
"/home/fccoelho/Downloads/cx_Freeze-3.0.2/initscripts/Console.py",
line 26, in ?
 File "epigrass.py", line 5, in ?
 File "Epigrass/manager.py", line 7, in ?
 File "Epigrass/simobj.py", line 4, in ?
 File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line
457, in ?
   try: return float(s)
 File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line
245, in wrapper
   if level not in self.levels:
 File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line
319, in _get_data_path
   Return the string representing the configuration dir.  If s is the
RuntimeError: Could not find the matplotlib data files

Matplotlib can't find its data files.
Apparently this problem comes up in py2exe as well and it is handled
like this:

from distutils.core import setup
import glob
import py2exe

data = glob.glob(r'C:\Python23\share\matplotlib\*')
data.append(r'C:\Python23\share\matplotlib\matplotlibrc')

setup( console    = ["simple_plot.py"],
      data_files = [("matplotlibdata", data)],
     )

This is the only thing I need to solve before I can distribute my
frozen package, so please help me here. There must be a way since the
frozen works in the original machine but not on the new Which also has
the same version of matplotib installed.




More information about the Python-list mailing list