From: John H. <jdh...@ac...> - 2004-08-18 14:11:38
|
>>>>> "John" == John Hunter <jdh...@ac...> writes: John> THE HACK for Windows users with the problematic install and John> behavior: change HOME to USERPROFILE in font_manager.py. Hi Alan, Thanks for the bug report and the pointer to the solution I added the following code to matplotlib.__init__.py above the get_data_path function def get_home(): """ return the users HOME dir across platforms or None. On win32, if either HOME is not set or HOME is set but doesn't exist, the value of USERPROFILE will be used instead. """ if os.environ.has_key('HOME'): path = os.environ['HOME'] if os.path.exists(path): return path if sys.platform=='win32' and os.environ.has_key('USERPROFILE'): path = os.environ['USERPROFILE'] if os.path.exists(path): return path return None And then use this everywhere in the code that wants HOME. Fortunately, that is only two places, once in matplotlib_fname and once in the font_manager. In font_manager, if you import it from matplotlib import rcParams, get_data_path, get_home and use it ttfpath = get_home() if ttfpath is None: ttfpath = get_data_path() ttfcache = os.path.join(ttfpath, '.ttffont.cache') it should fix the bug. Would you mind testing it for me? I tried it on a linux and winxp platform and it worked. But I never had problems before on those two platforms so it would be helpful to try yours as well. Thanks! JDH |