title: Python writing binary files, bytes
body: <p>Python 3. I'm using QT's file dialog widget to save PDFs downloaded from the internet. I've been reading the file using 'open', and attempting to write it using the file dialog widget. However, I've been running into a"TypeError: '_io.BufferedReader' does not support the buffer interface" error.</p>
  
  <p>Example code:</p>
  
  <pre><code>with open('file_to_read.pdf', 'rb') as f1: 
      with open('file_to_save.pdf', 'wb') as f2:
          f2.write(f1)
  </code></pre>
  
  <p>This logic works properly with text files when not using the 'b' designator, or when reading a file from the web, like with urllib or requests. These are of the 'bytes' type, which I think I need to be opening the file as. Instead, it's opening as a Buffered Reader. I tried bytes(f1), but get "TypeError: 'bytes' object cannot be interpreted as an integer." Any ideaas?</p>