From: Werner F. B. <wer...@fr...> - 2007-06-07 09:42:48
|
Hi Andrew, Werner F. Bruhin wrote: > Hi Andrew, > > Andrew Straw wrote: > >> Dear Werner, >> >> This seems to be an unintended side-effect of reorganizing the mpl >> data file location that I did prior to this release. (I.e. it's not >> your code that broke, I think it's mpl.) Unfortunately, since I didn't >> (and still don't) use py2exe, it will be hard for me to fix this. Can >> you send a patch that gets py2exe working again? >> > The work around I did is using glob.glob instead as follows: > > # matplotlib data > ##mpdir, mpfiles = matplotlib.get_py2exe_datafiles() > mpfiles = glob.glob('C:\Python25\lib\site-packages\matplotlib\mpl-data\*.*') > > But I can't confirm yet that this works as I am also trying out > something else in my InnoSetup script. Will confirm ASAP and will try > and look into matplotlib.get_py2exe_datafiles() and see how it could be > fixed. > I have change matplotlib.get_py2exe_datafiles() to: def get_py2exe_datafiles(): import glob mplfiles = [] for item in glob.glob(os.sep.join([get_data_path(), '*/*'])): if os.path.isdir(item): mplfiles += glob.glob(os.sep.join([item, '/*'])) mplfiles.append(os.sep.join([get_data_path(), 'matplotlibrc'])) try: mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib'])) except: pass return ('matplotlibdata', mplfiles) Now this creates a "flat" folder, i.e. all datafiles are directly under matplotlibdata. In my tests this works for me in my limited tests, with the exception that I also get the "Could not match Bitstream Vera ......etc" error - but this is something I also get with py2exe, so I don't know if this is an issue. Andrew, do you know if the sub-folder structure should be retained when using py2exe for matplotlib to work correctly in all circumstances? If that would be the case let me know and I try to come up with something. Werner |