title: Cannot load pickled object
body: <p>The problem I am having is when I try to load the <strong><a href="http://docs.python.org/3/library/pickle.html" rel="noreferrer">pickled</a></strong> object. I have tried using both <code>pickle.loads</code> and <code>pickle.load</code> Here are the results:</p>
  
  <p><code>pickle.loads</code>:</p>
  
  <blockquote>
    <p>TypeError: 'str' does not support the buffer interface</p>
  </blockquote>
  
  <p><code>pickle.load</code>:</p>
  
  <blockquote>
    <p>TypeError: file must have 'read' and 'readline' attributes</p>
  </blockquote>
  
  <p>Can someone please tell me what I am doing wrong in this process?</p>
  
  <pre><code>elif str(parser) == "SwissWithdrawn_Parser":
      # swissprot name changes
      print("Gathering SwissProt update info...")
      cache_hits = 0
      cache_misses = 0
      files = set()
  
      for f in os.listdir("out/cache/"):
          if os.path.isfile("out/cache/" + f):
              files.add(f)
  
      for name in sp_lost_names:
  
          cached = False
          url = (
              "http://www.uniprot.org/uniprot/?query=mnemonic%3a"
              + name
              + "+active%3ayes&amp;format=tab&amp;columns=entry%20name"
          )
          hashed_url = str(hash(url))
  
          ################### For Testing Only - use cache ##################
          if hashed_url in files:
              cached = True
              cache_hits += 1
              content = pickle.loads("out/cache/" + hashed_url)  # &lt;-- problematic line
          else:
              cache_misses += 1
              content = urllib.request.urlopen(url)
  
          # get the contents returned from the HTTPResponse object
          content_list = [x.decode().strip() for x in content.readlines()]
          if not cached:
              with open("out/cache/" + hashed_url, "wb") as fp:
                  pickle.dump(content_list, fp)
          ####################################################################
  
          # no replacement
          if len(content_list) is 0:
              change_log["swiss-names"] = {name: "withdrawn"}
          # get the new name
          else:
              new_name = content_list[1]
              change_log["swiss-names"] = {name: new_name}
  </code></pre>