Hi Jeff,

Jeff Peery wrote:
Hello,
I've been using matplotlib 0.87 and I upgraded to 0.91. I ran my setup script for py2exe which had been working flawlessly and now I get an error stating that the .../mpl-data/fonts is not a regular file or doesn't exist. I checked the filename path and it does actually exist. I'm using the matplotlib function get_py2exe_datafiles() to get the matplotlib data files. how might I correct this issue (I pasted a small sample code below)? thanks.
The folder structure in matplotlib has changed.

Attached is a sample setup.py for the "embedding_in_wx.py" matplotlib
example which has a "hack" to deal with this.  I haven't found a better
way to deal with this new folder structure, but for me this works.

Werner
Jeff # arguments for the setup() call
app = dict(
    script = "App.py",
other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="App"))],
    icon_resources =  [(1,'Figures/my_icon.ico')]
)
packages = ['numpy',
    'matplotlib',
    'pytz']
excludes = [
    '_gtkagg',
    '_tkagg',
    'tcl',
    'Tkconstants',
    'Tkinter',
    'tcl',
    'pywin.debugger',
    'pywin.debugger.dbgcon',
    'pywin.dialogs',
    'bsddb',
    'curses',
    'email',
    'distutil',
    'logging',
    'readline',
    'setuptools']
dll_excludes = [
    'libgdk_pixbuf-2.0-0.dll',
    'libgobject-2.0-0.dll',
    'libgdk-win32-2.0-0.dll']

Options = {"py2exe": {"skip_archive" : 1,
            "packages" : packages,
            "excludes" : excludes,
            "dll_excludes" : dll_excludes}}
## MATPLOTLIB DATA
data_Files=[(".",
["matplotlibrc", "config.txt", "user_agreement.rtf", "main.css"]),
            ("Figures",glob.glob("Figures\\*")),
            ("Documents",glob.glob("Documents\\*")),
            ("images",glob.glob("images\\*")),
            matplotlib.get_py2exe_datafiles()]

------------------------------------------------------------------------
Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. <http://us.rd.yahoo.com/evt=51731/*http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ>
------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


# -*- coding: iso-8859-1 -*-#
from distutils.core import setup
import os
from os.path import join
import shutil

import glob
import py2exe
from py2exe.build_exe import py2exe
import sys

import matplotlib as mp
matplotlib_font_afm = glob.glob(os.sep.join([mp.get_data_path(), 
'fonts/afm/*']))
matplotlib_font_pdfcorefonts = glob.glob(os.sep.join([mp.get_data_path(), 
'fonts/pdfcorefonts/*']))
matplotlib_font_ttf = glob.glob(os.sep.join([mp.get_data_path(), 
'fonts/ttf/*']))
matplotlib_images = glob.glob(os.sep.join([mp.get_data_path(), 'images/*']))

# following should not be needed as of py2exe 0.6.6
### cleanup dist and build directory first (for new py2exe version)
##if os.path.exists("dist/prog"):
##    shutil.rmtree("dist/prog")
##
##if os.path.exists("dist/lib"):
##    shutil.rmtree("dist/lib")
##
##if os.path.exists("build"):
##    shutil.rmtree("build")
##    

#
# A program using wxPython

# The manifest will be inserted as resource into the .exe.  This
# gives the controls the Windows XP appearance (if run on XP ;-)
#
manifest_template = '''
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="5.0.0.0"
    processorArchitecture="x86"
    name="%(prog)s"
    type="win32"
/>
<description>%(prog)s</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="AsInvoker"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>
'''

RT_MANIFEST = 32
#

# options for py2exe
options = {"py2exe": {"compressed": 1,
                      "optimize": 2,
                      "packages": ["encodings",
                                   "pytz", "matplotlib.numerix",
                                   ],
                      "excludes": ["MySQLdb", "Tkconstants", "Tkinter", "tcl"
                      ],
                      "dll_excludes": ["tcl84.dll", "tk84.dll", 
"wxmsw26uh_vc.dll"]
                      }
          }
zipfile = r"lib\library.zip"

class MetaBase:
    def __init__(self, **kw):
        self.__dict__.update(kw)
        self.version = '1.0'
        self.author = "yourname"
        self.author_email = "[EMAIL PROTECTED]"
        self.company_name = ""
        self.copyright = "2003 - 2007 by whoever"
        self.url = "http://www.whatever.com/";
        self.download_url = "http://www.whatever.com/en/";
        self.trademark = ""
        self.comments = "a comment on the prog"
        self.name = "the prog name"
        self.description = "a desc on the prog"

wx_emb = MetaBase(
            script = "embedding_in_wx.py",
            other_resources = [(RT_MANIFEST, 1, manifest_template % 
dict(prog="your prog name"))],
##            icon_resources = [(1, r"images/some.ico")],
            dest_base = r"prog\wx_embed")

setup(
      classifiers = ["Copyright:: your name",
                     "Development Status :: 5 Stable",
                     "Intended Audience :: End User",
                     "License :: Shareware",
                     "Operating System :: Microsoft :: Windows 2000",
                     "Operating System :: Microsoft :: Windows XP",
                     "Operating System :: Microsoft :: Windows 9x",
                     "Programming Language :: Python, wxPython",
                     "Topic :: Home Use"
                     "Natural Language :: German",
                     "Natural Language :: French",
                     "Natural Language :: English"],
      windows = [wx_emb],
      options = options,
      zipfile = zipfile,
      data_files = [("lib\\matplotlibdata", [os.sep.join([mp.get_data_path(), 
'matplotlibrc'])]),
                    ("lib\\matplotlibdata\\fonts\\afm", matplotlib_font_afm),
                    ("lib\\matplotlibdata\\fonts\\pdfcorefonts", 
matplotlib_font_pdfcorefonts),
                    ("lib\\matplotlibdata\\fonts\\ttf", matplotlib_font_ttf),
                    ("lib\\matplotlibdata\\images", matplotlib_images),
                    ]
    )

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to