title: How to find the real user home directory using python?
body: <p>I see that if we change the <code>HOME</code> (linux) or <code>USERPROFILE</code> (windows) environmental variable and run a python script, it returns the new value as the user home when I try</p>
  <pre><code>os.environ['HOME']
  os.exp
  </code></pre>
  <p>Is there any way to find the real user home directory without relying on the environmental variable?</p>
  <p><strong>edit:</strong><br />
  Here is a way to find userhome in windows by reading in the registry,<br />
  <a href="http://mail.python.org/pipermail/python-win32/2008-January/006677.html" rel="nofollow noreferrer">http://mail.python.org/pipermail/python-win32/2008-January/006677.html</a></p>
  <p><strong>edit:</strong><br />
  One way to find windows home using pywin32,</p>
  <pre><code>from win32com.shell import shell,shellcon
  home = shell.SHGetFolderPath(0, shellcon.CSIDL_PROFILE, None, 0)
  </code></pre>