Michael Droettboom wrote:
Chris Barker wrote:
I'm successfully getting all the MPL data files into spy2exe with:
DATA_FILES = matplotlib.get_py2exe_datafiles()
The problem is that that dumps a LOT of stuff, and I don't need most of it.
The default text font is Vera.ttf. (If you want to support bold and italic etc, you'll also need VeraBd.tff, VeraBI.ttf and VeraIt.ttf).
I removed all other fonts, and it works fine, thanks!
Alternatively, you can change the default fonts in the matplotlibrc to ones that are included with Windows (e.g. Arial) --
I took a look in matplotlibrc, and saw what looks like a html-ish cascade of fonts to look for, and Arial was in there. So I tried removing all the fonts, and behold, the system fonts were used. So now all I have in the mpl-data dir is matplotlibrc.
Then I thought, I haven't changed any defaults in matplotlibrc, either, so I pulled that out. Now it runs fine, but when I close, I get an error box:
see the logfile: ....
and indeed there is a
pH.exe.log file, and in there is:
C:\Documents and Settings\chris.barker\My Documents\HAZMAT\SmallTools\phCalculator\trunk\dist\pH.exe\matplotlib\__init__.py:520: UserWarning: Could not find matplotlibrc; using defaults
C:\Documents and Settings\chris.barker\My Documents\HAZMAT\SmallTools\phCalculator\trunk\dist\pH.exe\matplotlib\__init__.py:566: UserWarning: could not find rc file; returning defaults
Is there a way to supress those warnings and not write the logfile? I've never really liked matplotlibrc -- it's kind of nice not to have it at all, and it doesn't seem to be required. Maybe this is a wx issue -- how to bury that warning.
So then I tried removing mpl-data, but the app wouldn't run, I got an error, and the logfile says:
Traceback (most recent call last):
File "pH.py", line 8, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "Lib\Gui.pyo", line 15, in <module>
File "wxaddons\__init__.pyo", line 180, in import_hook
File "zipextimporter.pyo", line 82, in load_module
File "matplotlib\__init__.pyo", line 639, in <module>
File "matplotlib\__init__.pyo", line 562, in rc_params
File "matplotlib\__init__.pyo", line 517, in matplotlib_fname
File "matplotlib\__init__.pyo", line 207, in wrapper
File "matplotlib\__init__.pyo", line 447, in _get_data_path_cached
File "matplotlib\__init__.pyo", line 443, in _get_data_path
RuntimeError: Could not find the matplotlib data files
since I'm not, in fact needing any of the files in mpl-data, it might be nice if this error could be moved to when it's actually needed. I do notice that there is already a "if getattr(sys,'frozen',None)" stanza, so maybe we could tweak something there.
This may all be a pain, and I suppose this approach would only work with the simplest of MPL apps (like mine), but it would be nice to clean up MPL so that it plays better with py2exe and the like.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@...259...