On Fri, Aug 31, 2012 at 2:18 AM, Werner F. Bruhin <werner.bruhin@free.fr> wrote:

I am still on mpl 0.99.3 and this works for me, what mpl version are you
using?

import matplotlib as mpl
data_files += mpl.get_py2exe_datafiles()

But then I don't use mathtext.

I'm on 1.1.0
 
>
> I tried manually copying the entire mpl-data folder into the dist folder
> after running py2exe on setup.py but still I get the same error.
>
> Does data_files do anything other than include files and directories in
> the dist folder?

It just copies it to the correct location in your distribution folder,
i.e. for mpl I get "mpl-data" and it contains the "STIX...." fonts.

Do your font files end up directly in \mpl-data or in \mpl-data\font or something else?
I think (hope) my issue might be the findfont function is just looking in the wrong place.
 
> It seems that the findfont method in matplotlib's font_manager isn't
> working after running through py2exe and I guess when _get_glyph in
> mathtext.pyo attempts to use Bitstream Vera Sans font.
>
> Any ideas anyone?

IIRC there were some issues with this in some of the MPL versions 1.0.x.

BTW, you are not using py2exe optimize=1 ? If yes, try 2 or 3.

I've tried optimize = 2 and the default (?).