[Patches] [ python-Patches-523424 ] Finding "home" in "user.py" for Windows

noreply@sourceforge.net noreply@sourceforge.net
Wed, 27 Feb 2002 07:03:17 -0800


Patches item #523424, was opened at 2002-02-27 07:03
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=523424&group_id=5470

Category: Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Gilles Lenfant (glenfant)
Assigned to: Nobody/Anonymous (nobody)
Summary: Finding "home" in "user.py" for Windows

Initial Comment:
On my win2k French box + python 2.1.2:

>>> import user
>>> user.home
'C:\'

This isn't a great issue but this means that all users 
of this win2k box will share the same ".pythonrc.py".

The code provided by Jeff Bauer can be changed easily 
because the standard Python distro now has a "_winreg" 
module.

This patch gives the real user $HOME like folder for 
any user on whatever's Windows localization:

>>> import user
>>> user.home
u'C:\Documents and Settings\MyWindowsUsername\Mes 
documents'

This has been successfully tested with Win98 and 
Win2000. This should be tested on XP, NT4, and 95 but 
I can't.

Sorry for the "context or unified diffs" (dunno what 
it means) but the module is short and my patch is 
clearly emphasized.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=523424&group_id=5470