I see that if we change the environment variable HOME (linux) or USERPROFILE (windows) and run the script in python, it will return the new value as the user home, when I tried, os.environ ['HOME'] os.exp
Is there a way to find the home directory of a real user without relying on an environment variable?
edit:
Here is a way to find userhome on Windows by reading in the registry,
http://mail.python.org/pipermail/python-win32/2008-January/006677.html
edit:
One way to find Windows Home using Pywin32,
from win32com.shell import shell,shellcon home = shell.SHGetFolderPath(0, shellcon.CSIDL_PROFILE, None, 0)
python linux windows directory home-directory
asdfg Apr 19 '10 at 15:59 2010-04-19 15:59
source share