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

Alan G Isaac aisaac at american.edu
Sun Jul 17 16:30:27 CDT 2005


On Thu, 14 Jul 2005, Fernando Perez apparently wrote: 

> def get_home_dir(): 
>      """Return the closest possible equivalent to a 'home' directory. 
>      We first try $HOME.  Absent that, on NT it's $HOMEDRIVE\$HOMEPATH. 
>      Currently only Posix and NT are implemented, a HomeDirError exception is 
>      raised for all other OSes. """ 
>      try: 
>          return os.environ['HOME'] 

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']

fwiw,
Alan Isaac





More information about the IPython-user mailing list