title: When using pathlib, getting error: TypeError: invalid file: PosixPath('example.txt')
body: <p>I'm using Python 3's <a href="https://docs.python.org/3/library/pathlib.html" rel="noreferrer"><code>pathlib</code></a> module, like this:</p>
  
  <pre><code>from pathlib import Path
  
  filename = Path(__file__).parent / "example.txt"
  contents = open(filename, "r").read()
  </code></pre>
  
  <p>But I get this error on some machines:</p>
  
  <pre><code>TypeError: invalid file: PosixPath('example.txt')
  </code></pre>
  
  <p>But on my machine it works.</p>