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

Fernando Perez Fernando.Perez at colorado.edu
Mon Jul 18 13:21:52 CDT 2005


Alan G Isaac wrote:
> On Mon, 18 Jul 2005, Fernando Perez apparently wrote: 
> 
>>In WinXP Home and Pro there is a USERPROFILE and 
>>a HOMEPATH (which is used as a starting directory when 
>>running cmd.exe), but no HOME. So any HOME environment 
>>variable was added by customizing or by another 
>>application. 
> 
> 
> So in Win2000 and WinXP, in any case, relying on
> USERPROFILE will work better than relying on HOME.

Well, for NT if $HOME is undefined, I use this:

             try:
                 return 
os.path.join(os.environ['HOMEDRIVE'],os.environ['HOMEPATH'])
             except:
                 try:
                     # Use the registry to get the 'My Documents' folder.
                     import _winreg as wreg
                     key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
 
"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
                     homedir = wreg.QueryValueEx(key,'Personal')[0]
                     key.Close()
                     return homedir
                 except:
                     return 'C:\\'

That's from something I read long ago that said that HOMEDRIVE/HOMEPATH was 
the proper default location.  Is USERPROFILE the right one instead?  I think I 
read that at some microsoft page, but I could be wrong.

Cheers,

f

<rant>
ps - and some people still ask me why I hate windows with an unmitigated 
passion...  the platform where the phrase 'where do you want to go today' 
invariably means 'in circles', even for the simplest, seemingly most trivial 
of tasks.
</rant>




More information about the IPython-user mailing list