title: Python web scraping stopped working - Invalid File Error
body: <p>I have been working on a web scraping program and it has recently just stopped working and is giving me the following error.</p>
  <pre><code>Traceback (most recent call last):
    File &quot;C:/Users/Bob/Desktop/test 3.5.py&quot;, line 7, in &lt;module&gt;
      with open(saveDB,'rb') as f:
  TypeError: invalid file: WindowsPath('Z:/project1/MasterWellDB.txt')
  </code></pre>
  <p>Where Z: is a network drive, but I have also moved the file locally and the error still exists.</p>
  <p>I have tried multiple python versions, uninstalled and reinstalled visual studio multiple times and I am still clueless.</p>
  <p>Here is my code:</p>
  <pre><code>from pathlib import Path
  import pickle
  # Opening well database
  saveDB = Path(r&quot;Z:\project1\MasterWellDB.txt&quot;)
  #open picked DB if avaiable else remake database
  if saveDB.exists():
      with open(saveDB,'rb') as f:
          wells = pickle.load(f)
          print('success!')
          
  </code></pre>
  <p>Any help would be greatly appreciated. Thanks!</p>