title: How to get 'My Document' folder path by python?
body: <p>My script is combined with 'My Document' folder, but I could not get the path of it on windows 7.</p>
  <h2>First:</h2>
  <p>I followed <a href="https://stackoverflow.com/questions/6227590/finding-the-users-my-documents-path">this question.</a></p>
  <pre><code>os.path.expanduser(path)
  </code></pre>
  <p>But,as a comment said</p>
  <blockquote>
  <p>On Windows a os.path.expanduser('~/filename') call results in something like 'C:\Documents and Settings\/filename' which is not the path of something in the user's My Documents folder.</p>
  </blockquote>
  <p>If user move his 'My Document' folder, this would not work.</p>
  <h2>Then</h2>
  <p>I found another solution <a href="https://stackoverflow.com/questions/3858851/python-get-windows-special-folders-for-currently-logged-in-user">here</a>.<br />
  It seems works well with mypictures folder, but if I tried mydocuments I will got an error like:</p>
  <pre><code>&gt;&gt;&gt; print(shell.SHGetFolderPath(0, shellcon.CSIDL_MYDOCUMENTS, None, 0))
  Traceback (most recent call last):
    File &quot;&lt;pyshell#3&gt;&quot;, line 1, in &lt;module&gt;
      print(shell.SHGetFolderPath(0, shellcon.CSIDL_MYDOCUMENTS, None, 0))
  pywintypes.com_error: (-2147024809, 'argument error', None, None)
  </code></pre>
  <p>I was confused about that, so I googled another <a href="https://stackoverflow.com/questions/18493484/shgetfolderpath-deprecated-what-is-the-alternative">question</a> here.<br />
  It seems we should use <code>SHGetKnownFolderPath</code> function in windows7.<br />
  But I can't find this function in win32com.shell.</p>
  <h2>Finally</h2>
  <p>I got a way that would work which answered below yet I got more question now.</p>