[SciPy-user] Matplotlib problem under Windows: %HOME% expands to
Alan G Isaac
aisaac at american.edu
Tue Aug 17 19:31:45 CDT 2004
I found a Matplotlib problem under Win 2000.
Matplotlib appears to install fine under Windows 2000,
but trying to include text in a plot produces
the following error message:
Traceback (most recent call last):
File "C:\programs\Python23\lib\site-packages\matplotlib\font_manager.py", line 764, in __init__
pickle.dump(self.ttfdict, file(ttfcache, 'w'))
IOError: [Errno 2] No such file or directory: '%USERPROFILE%\\.ttffont.cache'
In matplotlib's font_manager.py, we find the line
ttfpath = os.environ.get('HOME', get_data_path())
(as well as one more problematic use of HOME).
Under Windows 2000 (and other Windows?),
%HOME% expands to %USERPROFILE%,
*not* to the user's home directory.
%USERPROFILE% in turn expands to the user's home directory,
but this expansion is not done by the line above.
this problem affects the installation as well:
a directory called literally '%USERPROFILE% is created!
THE HACK for Windows users with the problematic install
change HOME to USERPROFILE in font_manager.py.
Hopefully there is also a simple solution for Matplotlib,
but I'm just an end user so I won't propose one.
More information about the SciPy-user