diff options
-rw-r--r-- | Lib/posixpath.py | 6 | ||||
-rw-r--r-- | Lib/user.py | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 6c66689..d5d2621 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -303,8 +303,10 @@ def expanduser(path): i = i + 1 if i == 1: if not 'HOME' in os.environ: - return path - userhome = os.environ['HOME'] + import pwd + userhome = pwd.getpwuid(os.getuid())[5] + else: + userhome = os.environ['HOME'] else: import pwd try: diff --git a/Lib/user.py b/Lib/user.py index d0cb3ed..e550e52 100644 --- a/Lib/user.py +++ b/Lib/user.py @@ -26,6 +26,8 @@ import os home = os.curdir # Default if 'HOME' in os.environ: home = os.environ['HOME'] +elif os.name == 'posix': + home = os.path.expanduser("~/") elif os.name == 'nt': # Contributed by Jeff Bauer if 'HOMEPATH' in os.environ: if 'HOMEDRIVE' in os.environ: |