WinXP vs. Win98

S

sidanko

I use Python 2.3.3 (Enthought edition) with wxPython and it is
installed on both WinXP and Win98. On Win98 machine I have the
following error:
------------------------------------------------------------------------
Traceback (most recent call last):
File
"C:\PYTHON23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\My Documents\Programs\Python\SDV.py", line 2, in ?
from chaco.wxplot import *
File "C:\PYTHON23\lib\site-packages\chaco\wxplot.py", line 17, in ?
from wxplot_window import PlotWindow, PlotTraitSheet
File "C:\PYTHON23\lib\site-packages\chaco\wxplot_window.py", line 5,
in ?
from wxplot_window_agg import *
File "C:\PYTHON23\lib\site-packages\chaco\wxplot_window_agg.py", line
27, in
from kiva.agg import CAP_BUTT
File "C:\PYTHON23\lib\site-packages\kiva\agg\__init__.py", line 1, in
?
from agg import *
File "C:\PYTHON23\lib\site-packages\kiva\agg\agg.py", line 734, in ?
import freetype
File "C:\PYTHON23\lib\site-packages\freetype\__init__.py", line 6, in
?
from freetype import FreeType
File "C:\PYTHON23\lib\site-packages\freetype\freetype.py", line 10,
in ?
from font_lookup import default_font_info
File "C:\PYTHON23\lib\site-packages\freetype\font_lookup.py", line
24, in ?
font_dirs.append(os.path.join(os.environ[ 'systemroot' ],'fonts'))
File "C:\PYTHON23\lib\os.py", line 417, in __getitem__
return self.data[key.upper()]
KeyError: 'SYSTEMROOT'-----------------------------------------------------------------------
Hovewer running very the same script on WinXP machine I have no
problems at all. What's wrong? Kiva package (as well as others) is
installed properly. Where to dig?

AS
 
F

Fredrik Lundh

I use Python 2.3.3 (Enthought edition) with wxPython and it is
installed on both WinXP and Win98. On Win98 machine I have the
following error:
File "C:\PYTHON23\lib\site-packages\freetype\font_lookup.py", line
24, in ?
font_dirs.append(os.path.join(os.environ[ 'systemroot' ],'fonts'))
File "C:\PYTHON23\lib\os.py", line 417, in __getitem__
return self.data[key.upper()]
KeyError: 'SYSTEMROOT'
Hovewer running very the same script on WinXP machine I have no
problems at all. What's wrong? Kiva package (as well as others) is
installed properly. Where to dig?

Windows XP has SystemDrive and SystemRoot environment variables,
while Windows 98 don't seem to have them.

a quick workaround is to set the SystemRoot environment by hand (it should
point to the Windows system directory; usually c:\windows. iirc, you have to
edit AUTOEXEC.BAT or run the MSCONFIG utility to set them).

alternatively, you can add the following fix to your application code:

import os
os.environ["SystemRoot"] = os.environ.get("windir", "c:\\windows")

(put it *before* the wxplot import code)

a better fix is to make the freetype font_lookup code a bit more robust.

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top