[ python-Bugs-1749583 ] expanduser("~") on Windows looks for HOME first
SourceForge.net
noreply at sourceforge.net
Sat Jul 7 21:10:06 CEST 2007
Bugs item #1749583, was opened at 2007-07-07 05:44
Message generated for change (Comment added) made by hdiwan650
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1749583&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Edward Diener (eldiener)
Assigned to: Nobody/Anonymous (nobody)
Summary: expanduser("~") on Windows looks for HOME first
Initial Comment:
On Windows, using expanduser("~") the home directory is replaced either first by the environment variable HOME or, if that is not found, by a combination of HOMEDRIVE and HOMEPATH."
But HOME is almost never the home directory for Windows, although it is under Linux/Unix, only the combination of HOMEDRIVE and HOMEPATH is valid, which is always set.
If MSYS is installed under Windows, where HOME must be set to the MSYS home directory for a given user in order to emulate Linux/Unix, attempting to use os.path.expanduser("~") will incorrectly return the MSYS home directory for a given user rather than the Windows home directory for the logged in user. So I think the os.path.expanduser("~") works incorrectly in this case and needs to be fixed, else you are telling users never to use MSYS under Windows. There may be other Linux/Unix emulation packages which can be installed under Windows, and my guess is that if there is then the HOME environment variable gets set to some user home directory under that emulation package, just like it does for MSYS.
The correct order under Windows is to look for the environment variable combination HOMEDRIVE/HOMEPATH first and only if that is not found ( very unlikely ) should expanduser("~") look for the environment variable HOME.
----------------------------------------------------------------------
Comment By: Hasan Diwan (hdiwan650)
Date: 2007-07-07 12:10
Message:
Logged In: YES
user_id=1185570
Originator: NO
This has been fixed as of Rev 54419 in trunk, perhaps someone would be
kind enough to backport it?
----------------------------------------------------------------------
Comment By: Hasan Diwan (hdiwan650)
Date: 2007-07-07 12:08
Message:
Logged In: YES
user_id=1185570
Originator: NO
This has been fixed as of Rev 54419 in trunk, perhaps someone would be
kind enough to backport it?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1749583&group_id=5470
More information about the Python-bugs-list
mailing list