[Python-Dev] PEP 370, open questions
mail at timgolden.me.uk
Thu Jan 17 16:36:00 CET 2008
Paul Moore wrote:
> On 17/01/2008, Tim Golden <mail at timgolden.me.uk> wrote:
>>> Is %USERPROFILE% not equal to %HOMEDRIVE%%HOMEPATH%?
>> No. On my machine, for example:
>> USERPROFILE=C:\Documents and Settings\goldent
>> However, using an account without a mapped home
>> drive then yes, they are the same.
> Given this information (and the earlier comments about roaming
> profiles) I would suggest that Python should use %HOMEDRIVE%HOMEPATH%.
> This matches os.path.expanduser('~'). My previous comments were based
> on my experience on a machine without a mapped home drive, so I'd
> missed the distinction.
> Yes, this does contradict the Microsoft guideline that you shouldn't
> write to USERPROFILE, but Microsoft themselves set HOMEDRIVE and
> HOMEPATH, so they vioated the guidelines, not us :-).
> The point here is that we want "the user's home". This is clearly
> %HOMEDRIVE%%HOMEPATH% on Windows, guidelines notwithstanding.
A few datapoints here from WinXP SP2. I'll try Win2k when I
get home this evening if no-one's done it before then.
My support guys have temporarily switched me over to a roaming
profile so I could check what happens. As
expected, all the non-Local... folders are copied to and from
the network share specified as ProfilePath on my AD entry. (In
fact, our policy forbids profiles bigger than a few tens of Mb
so I had to hive off my existing profile and create a new one
to do this test).
Ignoring Terminal Services -- which have their own profiles --
and Cygwin -- which does its own thing -- we have four
situations: Users with and without mapped HOME drives; and with
and without network (roaming) profiles.
USERPROFILE points to c:\docu..\goldent regardless of whether
it's a network-based profile or not. The difference is what
happens when you log on/off.
If the home drive is mapped, HOMEDRIVE/PATH point to that mapping
If the home drive isn't mapped, HOMEDRIVE/PATH point to
APPDATA is a non-local part of othe profile and as such is
copied to and from the network share if the profile is roaming.
There doesn't seem to be a clear solution.
If we point to APPDATA, HOMEDRIVE/PATH or USERPROFILE
we might be bulking up the content a user has to copy
to and fro. And local space policies might hinder things.
If we point to local settings\application data then the
packages won't roam with the user.
The best we can hope for is to point to HOMEDRIVE/PATH as
Paul suggested (*possibly* rewiring os.path.expanduser to
try that first, depending on Win2K stuff) and make sure
the user is aware of what might happen if the HOMEDRIVE/PATH
is really a pointer to a network-based profile.
More information about the Python-Dev