title: Cygwin and Windows path conflict; using both Windows and cygwin Python
body: <p>I've installed cygwin on Windows XP. Mercurial on cygwin stopped working after I installed some software on Windows. The symptom can be simplified to python not being able to locate modules in its library:</p>
  
  <pre><code>&gt;&gt;&gt; import os
  Traceback (most recent call last):
    file "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: No module named os
  </code></pre>
  
  <p>One of the pieces of software I installed in Windows (subversion) uses python so now Windows has its own Python installation. Don't ask why I wish to use mercurial under cygwin and subversion under Windows; suffice to say I do, but that's beside the point. It seems cygwin tries to use the Windows python instead of its own, or at least that's what I think is happening. If that's not the cause, please enlighten me. Anyway...</p>
  
  <p>$ find /cygdrive/c -name os.py
     /cygdrive/c/csvn/Python25/Lib/os.py
     /cygdrive/c/cygwin/lib/python2.6/os.py</p>
  
  <p>echo $PATH confirms that /cygdrive/c/csvn/Python25 is before /usr/lib/python2.6. I'm no cygwin wiz, but from what I can tell /etc/profile adds the Windows path to cygwin's $PATH, and I don't know how to keep it from doing so. As a workaround I modified .profile to explicitly set PATH, excluding those paths from Windows. But, the problem remains:</p>
  
  <pre><code>$ echo $PATH
  /usr/local/bin:/usr/bin:/usr/lib/python2.6
  $ hg
  'import site' failed; use -v for traceback
  Traceback (most recent call last):
    File "/usr/bin/hg", line 10, in &lt;module&gt;
      import os
  ImportError: No module named os
  
  $ ls /usr/lib/python2.6/os.py
  /usr/lib/python2.6/os.py
  </code></pre>
  
  <p>It looks like the path conflict has not actually been resolved, because when I issue the above "find" command again I get the same results, with /cygdrive/c/csvn/Python25/Lib/os.py showing up first. In theory there may be some other reason python isn't working on cygwin, but not being able to control my PATH would still be a problem.  Any ideas? </p>