Finding user's home dir

Duncan Booth duncan.booth at invalid.invalid
Thu Feb 3 09:46:01 EST 2005


Peter Hansen wrote:

> Nemesis, please use the above recipe instead, as it makes
> the more reasonable (IMHO) choice of checking for a HOME
> environment variable before trying the expanduser("~")
> approach.  This covers folks like me who, though stuck
> using Windows, despise the ridiculous Microsoft convention
> of "user folders" named like "C:\Documents and Settings\Peter"
> and prefer to create sensible folder like c:\users\peter
> and set a HOME variable to point to it.  Your approach
> ignores our HOME variable.

You could just tell Windows to move your home directory location to 
c:\users\peter and then all the environment variables will be set for you 
automatically.

It probably varies wildly between Windows versions, but to assign a home 
folder for a local user on XP go to Control Panel/Administrative 
Tools/Computer Management/Local Users and Groups/Users, select your 
account, right menu Properties, Profile tab, and edit the 'Home folder' 
setting. Press F1 while editing the home folder location and see that at 
least someone at Microsoft thinks c:\users\... is a sensible location.

See also http://support.microsoft.com/?kbid=816313 for domain users etc.



More information about the Python-list mailing list