Had the same problem, solved with the setup.py attached ;)
Just modify it to fit your needs, should be a good start.
Works under vista + matplotlib 0.98.3
Cheers
Laurent

> -----Message d'origine-----
> De : Ron Adelman [mailto:[EMAIL PROTECTED]
> Envoyé : samedi 20 septembre 2008 23:17
> À : matplotlib-users@lists.sourceforge.net
> Objet : [Matplotlib-users] py2exe with pylab
> 
> I followed the thread in Sept 2007 that covers the same problem I am
> having, but it seems to just end without a solution.
> 
> I have attached the setup file I am using.  When my application is
> packaged, installed and I try to get my graph I get the following
> message.  The graph works fine while I am working from just the python
> script in idle.
> 
> Traceback (most recent call last):
>   File "WxPyETn.py", line 4070, in GetRevGraph
>   File "matplotlib\__init__.pyc", line 677, in <module>
>   File "matplotlib\__init__.pyc", line 598, in rc_params
>   File "matplotlib\__init__.pyc", line 552, in matplotlib_fname
>   File "matplotlib\__init__.pyc", line 242, in wrapper
>   File "matplotlib\__init__.pyc", line 482, in _get_data_path_cached
>   File "matplotlib\__init__.pyc", line 478, in _get_data_path
> RuntimeError: Could not find the matplotlib data files
> 
> I really try to avoid posting and believe me, I have spent hours trying
> to figure a solution, but I am just plain ignorant with this and I
> feel there is a common solution out there someplace.
> 
> 
> Ron Adelman, CGFM
> Fiscal Consultant
> Dept. of Education (SouthWest District)
> 314 E. Main
> Jackson, TN   38301
> Phone: 731-927-8787
> State Cell:  615-306-4062
> Cell:  731-697-0967
> Fax: 731-422-1406
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
##---------------------------------------------------------------------------------------------------
__version__ = 0.3
__author__  = "Laurent Dufrechou"
__email__   = "[EMAIL PROTECTED]"
__license__ = "BSD"
##---------------------------------------------------------------------------------------------------

manifest = """
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
    version="0.64.1.0"
    processorArchitecture="x86"
    name="Controls"
    type="win32"
/>
<description>myProgram</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>
"""

import os
import sys
sys.stdout = open('screen.txt','w',0)
sys.stderr = open('errors.txt','w',0)

sys.path.insert(0, "../Filters")
sys.path.insert(0, "../SysFiles")

def rmdir_recursive(dir, keep=[]):
    """Remove a directory, and all its contents if it is not already empty."""

    print >>sys.__stdout__,'> Removing files in directory :' + dir + ',keeping 
protected files...'
    print '> Removing files in directory :' + dir + ',keeping protected 
files...'
    for name in os.listdir(dir):
        if name not in keep:
            full_name = os.path.join(dir, name)
            # on Windows, if we don't have write permission we can't remove
            # the file/directory either, so turn that on
            if not os.access(full_name, os.W_OK):
                os.chmod(full_name, 0600)
            if os.path.isdir(full_name):
                rmdir_recursive(full_name, keep=keep)
            else:
                os.remove(full_name)
        else:
            print >>sys.__stdout__,'> keeping ' + name + ' in ' + dir
            print '> keeping ' + name + ' in ' + dir
    if keep == []:
        print >>sys.__stdout__,'> Removing directory :' + dir + 'because no 
file asked to be kept.'
        print '> Removing directory :' + dir + 'because no file asked to be 
kept.'
        os.rmdir(dir)

try:
    rmdir_recursive('./dist', keep=".svn")
except:
    print >>sys.__stdout__,'./dist: nothing to remove.'
    print './dist: nothing to remove.'
             
# setup.py

# Used successfully in Python2.5 with matplotlib 0.91.2 and PyQt4 (and Qt 
4.3.3) 
from distutils.core import setup
import py2exe

# We need to exclude matplotlib backends not being used by this executable.  
You may find
# that you need different excludes to create a working executable with your 
chosen backend.
# We also need to include include various numerix libraries that the other 
functions call.

opts = {
    'py2exe': { "compressed": 1,
                "optimize": 1,
                #"ascii": 1,
                "bundle_files": 1,
                'packages' : ["matplotlib.backends.backend_wxagg",
                              "matplotlib.numerix.fft",
                              "matplotlib.numerix.linear_algebra",
                              "matplotlib.numerix.random_array",
                              "matplotlib.numerix.ma"
                              ],
                'excludes': ['_tkinter'
                #             '_gtkagg', '_tkagg', '_agg2', '_cairo', 
'_cocoaagg',
                #             '_fltkagg', '_gtk', '_gtkcairo','_backend_gdk',
                #             '_gobject','_gtkagg','_tkinter','glade','pango',
                #             'QtCore','QtGui'
                             ],
                'dll_excludes': ['tk84.dll',
                                 'tcl84.dll',
                #                 'libgdk_pixbuf-2.0-0.dll',
                #                 'libgdk-win32-2.0-0.dll',
                #                 'libgobject-2.0-0.dll',
                #                 'libgtk-win32-2.0-0.dll',
                #                 'libglib-2.0-0.dll',
                #                 'libcairo-2.dll',
                #                 'libpango-1.0-0.dll',
                #                 'libpangowin32-1.0-0.dll',
                #                 'libpangocairo-1.0-0.dll',
                #                 'libglade-2.0-0.dll',
                #                 'libgmodule-2.0-0.dll',
                #                 'libgthread-2.0-0.dll',
                #                 'tk84.dll',
                #                 'tcl84.dll',
                                  ]
              }
       }

# Save matplotlib-data to mpl-data ( It is located in the matplotlib\mpl-data 
# folder and the compiled programs will look for it in \mpl-data
import matplotlib
data_files = matplotlib.get_py2exe_datafiles()
data_files.append(('ressources', ['..//Ressources//my.bmp']))
data_files.append(('ressources', ['..//Ressources//my.ico']))


# for console program use 'console = [{"script" : "scriptname.py"}]
setup(name='SDS Analyst',
      version='0.1',
      author='AB',
      windows=[{'script' : "..//SDSAnalyst.py",
                'icon_resources':[(1,'..//Ressources//my.ico')],
                'other_resources':[(24,1,manifest)],
               }],
      options=opts,
      zipfile = None,
      data_files=data_files)

#some cleanup
rmdir_recursive('./dist/tcl')
rmdir_recursive('./build')
print "---Done---"
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to