title: How to effectively convert a POSIX path to Windows path with Python in Cygwin?
body: <h2>Problem</h2>
  
  <p>Imagine you are writing a Python script which runs on cygwin and calls an external C# executable which requires as input a path.
  Assume you cannot change the C# executable in any way.
  As you send the path you want to the executable, it rejects all cygwin paths.</p>
  
  <p>So if you pass the path <code>/cygdrive/c/location/of/file.html</code> as a POSIX path, it will fail as the executable requires a Windows path like <code>C:\location\of\file.html</code></p>
  
  <p>Example:</p>
  
  <p><code>Message location = os.path.dirname(os.path.realpath(__file__))</code>
  <code>os.system('./cSharpScript.exe ' + message_location)</code></p>
  
  <p>Will result in:</p>
  
  <p><code>File for the content (/cygdrive/c/location/of/file.html) not found.</code></p>
  
  <h2>Things I've tried so far:</h2>
  
  <p>PATH = /cygdrive/c/location/of/file.html</p>
  
  <p>1) <code>path = PATH.replace('/','\\')</code></p>
  
  <p>Result: <code>File for the content (cygdriveclocationoffile.html) not found.</code></p>
  
  <p>2) <code>path  = os.path.abspath(PATH)</code></p>
  
  <p>Result: <code>File for the content (/cygdrive/c/location/of/file.html) not found.</code></p>
  
  <ul>
  <li><code>os.path.realpath</code> has the same results</li>
  </ul>
  
  <p>I'm probably going in a completely wrong direction with my solutions so far... How would you handle it?</p>