title: Opening a file which is a symlink in Python
body: <p>I have some python code that opens a file to read it like so...</p>
  
  <pre><code>with open("file.txt") as f:
      print(f.read())
  </code></pre>
  
  <p>On MacOS, if <code>file.txt</code> is a symlink - Python will follow the symlink and read the target file. However, on Windows it does not do this - how can I achieve this?</p>
  
  <p>(Using Python version 3.6.5 and Windows 10)
  Steps to reproduce.</p>
  
  <ol>
  <li>Create <code>FileA.txt</code> in <code>DirectoryA</code> which is above <code>DirectoryB</code></li>
  <li>Inside <code>DirectoryB</code>, Run <code>mlink FileA.txt "../FileA.txt"</code></li>
  <li>Run a Python script which attempts to read and print from the <code>FileA.txt</code> link in <code>DirectoryB</code></li>
  </ol>
  
  <p>Expected Behaviour:</p>
  
  <p>The contents of <code>FileA.txt</code> inside <code>DirectoryA</code> should be printed</p>
  
  <p>Actual Behaviour:</p>
  
  <p><code>OSError: [Errno 22] Invalid argument: 'FileA.txt'</code></p>