title: TypeError: a bytes-like object is required, not 'str' Python 3 download long file
body: <p>I am trying to download a file in BLOB format with Python 3, this file is very 'heavy' for a database. Someone can help me with my code:</p>
  
  <pre><code>fout = open('D:\files.zip','wb')
  def readBLOB ():
     try:
          conn = mysql.connector.connect(host='(IP)',user='(user)', passwd='(password)', db='(Database)', port=PORT)
          cursor = conn.cursor()
          sql_fetch_blob_query = "SELECT archivo FROM versiones_archivos order by id desc limit 1"
          cursor.execute (sql_fetch_blob_query)
          fout.write(cursor.fetchone()[0])
          fout.close()
  
      finally:
          if (conn.is_connected()):
              cursor.close()
              conn.close()
  readBLOB()
  </code></pre>
  
  <p>The error I get is the following</p>
  
  <pre><code>TypeError: a bytes-like object is required, not 'str'
  </code></pre>
  
  <p>Any expert in python that can help me solve or have some other alternative to my script I would really appreciate</p>