[IPython-user] Re[2]: IPython install under Win2000

Fernando Perez Fernando.Perez at colorado.edu
Sun Jul 17 21:38:41 CDT 2005

Alan G Isaac wrote:

> But os.environ['HOME'] == '%USERPROFILE%' which you do not
> expand!
> Again, I have seen this problem arise before, so I do not 
> think my problem is unique.  In any case, it can be fixed by 
> a small change:
>         if os.environ['HOME']=='%USERPROFILE%':
>         	return os.environ['USERPROFILE']
>         else: return os.environ['HOME']

Well, the fix is easy enough to apply.  However, it smells a bit fishy to me: 
why would an environment variable resolve to something else which needs to be 
re-expanded?  I know that under Windows all kinds of bizarre things are 
considered normal, but this I find a bit odd.  Environment variables are, at 
least in my mind, end-values which should be usable as-is.

So I'd like to hear from those with Win32 expertise if this is really standard 
practice in the win32 world I should code defensively against.  And if so,  is 
one level of re-evaluation enough?  Can %USERPROFILE% itself point to 
%SOMETHINGELSESTILL%? Should I keep expanding all %XXX% forms?

Some guidance from the win32 gurus would be much appreciated here on what the 
proper approach to follow should be.



More information about the IPython-user mailing list