py2exe and jp windows

Hi,

I thought I'd mention some small isuues I found with using py2exe to deploy matplotlib 0.63.2 on Japanese Windows 2000.

* pytz seems to need a copy of C:\Python23\Lib\site-packages\pytz\zoneinfo in the installed folder, otherwise it gives a KeyError on UTC when matplotlib is imported

* pygtk.require() is not compatible with py2exe, so I added a wrapper to backend_gtk.py to check for freezing:

if not hasattr(sys, 'frozen'):
     try:
          # Don't want to check this for py2exe
          import pygtk
          pygtk.require('2.0')
     except:
         print sys.exc_info()[1]
         raise SystemExit('PyGTK version 1.99.16 or greater is required to run the GTK/GTKAgg Matplotlib backend')

* font_manager.py throws an exception, I suspect to do with Japanese font names or font directory names:

File "c:\Python23\lib\site-packages\matplotlib\font_manager.py", line 111, in
win32InstalledFonts
     key, direc, any = _winreg.EnumValue( local, j)
WindowsError: [Errno 234]

from this site:

http://www.google.com.au/search?q=cache:B8BlgKwVYxcJ:www.cubelab.com/ymasuda/python/index_jp.html+matplotlib+local+None+windowserror&hl=en

I found a workaround to add

local = None

at line 107 of font_manager.py to give this:

     for fontdir in MSFontDirectories:
         try:
             local = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, fontdir)
         except OSError:
             continue

         local = None

         if not local:
             return glob.glob(os.path.join(directory, '*.'+fontext))

* gtk 2.2.? was crashing (segfault) on Japanese Win2k so I upgraded to the latest (2.4.13) and now it seems to work. However now I get various dprecation warnings about the GTK toolbar when I show a plot. And IPython seems to break with GTK 2.4.x.

* Generally getting it all to work required quite a bit of fiddling and munging various recipes I found on email lists and in the pygtk FAQ. This included copying the matplotlib shared data into the installation and experimenting with different locations for it, and copying the gtk runtime into the installation and modifying the path within python so it could be found.

Thanks for matplotlib!

Cheers,
Matthew.